Replace first character of string

后端 未结 7 867
走了就别回头了
走了就别回头了 2020-12-05 23:01

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 (\'\'

7条回答
  •  情歌与酒
    2020-12-05 23:32

    "|0|0|0|0".split("").reverse().join("")  //can also reverse the string => 0|0|0|0|
    

提交回复
热议问题