How to replace all the occurences of a particular character in a string?


I want to replace all the ‘.’ and ‘,’ available on the string with ’ '(Space).


Use replace method

str_output = System.Text.RegularExpressions.Regex.Replace(str_input, “[.|,]”, " ")

Change comma to point

Str.Replace("."," “).Replace(”,"," ")


Hi Ajith,

Use the Regular expression to perform the replace operation.

For Eg.
import System.Text.RegularExpressions

To replace the specific charecter

To replce the number from string

Vivek S.