javascript replace() function replace only single characters
I have been trying to use javascript replace() to search and replace special individual characters in a string. But having some difficulties.
We can use the following way to solve the following problem.
function ReplaceAllInstanceOfString(strString,strReplaceString,strReplaceByString)
{
var intPos= strString .indexOf('+ strReplaceString +');
if ( intPos !=-1)
{
strString = strString .replace(/,/g,' + strReplaceByString + ');
}
return strString ;
}