How to replace a character with another character in a string ( choose the best way of doing it ) ?
Use replace method.
Use remove method and then use insert method.
Use substring method.
None of the above.
You can replace a character with another character in a string using replace as well as remove and insert methods combination.
But the ideal choice is replace method .
Sample Code :
string s = " skullgun";
//replacing u with char 'i' .
string newString=s.Replace('u', 'i');
Back To Top