C++ String replace()This function replaces the portion of string that begins at character position pos and spans len characters. SyntaxConsider two strings str1 and str2. Syntax would be: Parameters
Return valueThis function does not return any value. Example 1First example shows how to replace given string by using position and length as parameters. Output: Before replacement , string is This is C language After replacement, string is This is C++ language Example 2Second example shows how to replace given string using position and length of the string which is to be copied in another string object. Output: Before replacement, String is This is C language After replacement, String is This is java language Example 3Third example shows how to replace the string by using string and number of characters to be copied as parameters. Output: Before replacement,string is This is C language After replacement,string is This is C# language
Next TopicC++ Strings
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week