You can remove the first character of a string using substring
:
var s1 = "foobar";
var s2 = s1.substring(1);
alert(s2); // shows "oobar"
To remove all 0’s at the start of the string:
var s = "0000test";
while(s.charAt(0) === '0')
{
s = s.substring(1);
}
More Related Contents:
- How do I make the first letter of a string uppercase in JavaScript?
- How do I replace a character at a particular index in JavaScript?
- Trim string in JavaScript?
- How to count string occurrence in string?
- Fastest method to replace all instances of a character in a string [duplicate]
- Evaluating a string as a mathematical expression in JavaScript
- How can I use backslashes (\) in a string?
- Strip all non-numeric characters from string in JavaScript
- What is the correct way to check for string equality in JavaScript?
- How to find if an array contains a specific string in JavaScript/jQuery?
- Convert string with commas to array
- Check for special characters in string
- Contains case insensitive
- Regular expression which matches a pattern, or is an empty string
- Finding all indexes of a specified character within a string
- How to build query string with Javascript
- javascript regular expression to check for IP addresses
- Passing regex modifier options to RegExp object
- Recursively print all permutations of a string (Javascript)
- How do I split a string into an array of characters? [duplicate]
- How to check if a string array contains one string in JavaScript? [duplicate]
- detect differences between two strings with Javascript
- Determine if string is in list in JavaScript
- How to get the day of the week from the day number in JavaScript?
- Cutting a string at nth occurrence of a character
- Reformat string containing date with Javascript
- Javascript / Jquery – Get number from string
- How to test if a URL string is absolute or relative?
- Split a string, at every nth position, with JavaScript? [duplicate]
- Javascript – Replacing the escape character in a string literal