且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Javascript中删除字符串的第一个字符

更新时间:2022-06-05 15:53:13

var s = "0000test";
while(s.charAt(0) === '0')
{
 s = s.substr(1);
}

这会杀死字符串开头的任何0。

This will kill any 0's at the start of the string.