The below is the function it will replaces all the occurrences by passing parameters
function strReplaceAll(string, Find, Replace){
try{
return string.replace( new RegExp(Find, "gi"), Replace );
}catch(ex){return string;}
}
var address = "Chirala, Hyderabad, Andhra Pradesh";
address = strReplaceAll(address, ",", " ");
Here i want to replace all the , occurrences in the string with spaces..
0 comments:
Post a Comment