Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ replace character in string

#include <algorithm>
#include <string>

void some_func() {
  std::string s = "example string";
  std::replace( s.begin(), s.end(), 'x', 'y'); // replace all 'x' to 'y'
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: extern shared memory 
Cpp :: c++ split long code 
Cpp :: convert whole string to uppercase c++ 
Cpp :: c++ random number generator 
Cpp :: HOW TO TURN LINK TO BUTTON IN MVC 
Cpp :: c++ in linux 
Cpp :: how can I replace a pattern from string in c++ 
Cpp :: how to get 4 decimal places in c++ 
Cpp :: __lg(x) in c++ 
Cpp :: qlabel font color 
Cpp :: c++ get last character of string 
Cpp :: cpp rand 
Cpp :: c++ string to integer without stoi 
Cpp :: c++ check if string contains non alphanumeric 
Cpp :: convert decimal to binary c++ 
Cpp :: compare float values c++ 
Cpp :: how to make a c++ program which takes two integers and calculate average 
Cpp :: lcm function c++ 
Cpp :: bash test empty directory 
Cpp :: cpp bubble sort 
Cpp :: vector to string c++ 
Cpp :: c++ functions 
Cpp :: sort using lambda c++ 
Cpp :: for loop with array c++ 
Cpp :: two pointer in c++ 
Cpp :: c++ typeid 
Cpp :: how to make a typing effect c++ 
Cpp :: cpp std list example 
Cpp :: log base 10 c++ 
Cpp :: c++ get type name of object 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =