Skip to content

Instantly share code, notes, and snippets.

@os0x
Created June 2, 2009 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save os0x/121940 to your computer and use it in GitHub Desktop.
Save os0x/121940 to your computer and use it in GitHub Desktop.
function parseIntRight(str,radix){
return parseInt(str.split(/\D/).pop(),radix);
}
/*
String.prototype.parseIntRight=function(radix){
return parseInt(this.split(/\D/).pop(),radix);
};
// ["wer12".parseIntRight(),parseIntRight("sas124")]; //-> 12,124
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment