I have a string |0|0|0|0
but it needs to be 0|0|0|0
How do I replace the first character ('|') with (''). eg replace('|','')
(with JavaScript)
Sign Up to our social questions and Answers Engine to ask questions, answer peopleβs questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer peopleβs questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do exactly what you have π
You can see it working here,
.replace()in javascript only replaces the first occurrence by default (without/g), so this works to your advantage πIf you need to check if the first character is a pipe:
You can see the result here