Skip to content

Instantly share code, notes, and snippets.

@mariusschulz
Created October 11, 2014 16:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariusschulz/9cdcc5a72960259c9573 to your computer and use it in GitHub Desktop.
Save mariusschulz/9cdcc5a72960259c9573 to your computer and use it in GitHub Desktop.
A JavaScript trimStart function
function trimStart(character, string) {
var startIndex = 0;
while (string[startIndex] === character) {
startIndex++;
}
return string.substr(startIndex);
}
@jrpacheco
Copy link

Thank you by implementation! helpful a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment