I have a string |0|0|0|0
|0|0|0|0
but it needs to be 0|0|0|0
0|0|0|0
How do I replace the first character (\'|\') with (\'\'
\'|\'
\'\'
Try this:
var str = "|0|0|0|0"; str.replace(str.charAt(0), "");
Avoid using substr() as it's considered deprecated.