try the following
const std::string s = "*A";
const std::string t = "*A\n";
std::string::size_type n = 0;
while ( ( n = chartDataString.find( s, n ) ) != std::string::npos )
{
chartDataString.replace( n, s.size(), t );
n += t.size();
}
More Related Contents:
- What is the difference between palindrome permutation and permutation? [closed]
- How to replace all occurrences of a character in string?
- Fast String Hashing Algorithm with low collision rates with 32 bit integer [closed]
- Splitting a string by a character
- C++ string::find complexity
- Are there any better methods to do permutation of string?
- Similar String algorithm
- Mixing two arrays by alternating elements two by two
- banker’s algorithm in c++
- How to convert an instance of std::string to lower case
- Remove spaces from std::string in C++
- Sorting zipped (locked) containers in C++ using boost or the STL
- Convert string to variable name or variable type
- Check if a string contains a string in C++
- How do I check if a C++ string is an int?
- Find out if string ends with another string in C++
- Case insensitive std::string.find()
- Convert String containing several numbers into integers
- How to convert a char array to a string?
- write and read string to binary file C++
- How can std::make_heap be implemented while making at most 3N comparisons?
- Writing a simple equation parser
- What is the right approach when using STL container for median calculation?
- Howto create combinations of several vectors without hardcoding loops in C++?
- Press Enter to Continue
- Ways to do modulo multiplication with primitive types
- Removing ‘#include ‘ doesn’t break the code
- What’s time complexity of this algorithm for finding all combinations?
- how to get hash code of a string in c++
- Where are string literals stored, and can I modify them?