Skip to content

THE ultimate javascript function to parse strings (or even objects) to integers!

Notifications You must be signed in to change notification settings

bullgit/parseint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

parseint

Let's say you've got a word or a string that, and you need to parse it to an integer. What function would you use?

If your answer was parseInt(that), then you're totally wrong and should be ashamed of yourself. The only correct method is this one.

This will work even on strings in languages not english!

implementation

  1. download the script and load it before the end of your <body>
  <script src="parseint.js"></script>
  <script src="main.js"></script> <!-- your own main script -->
</body>
  1. Call the parseint method on your wanted string
Console.log(parseint('four'));    // 4
Console.log(parseint('vier'));    // 4
Console.log(parseint('quatre'));  // 4
Console.log(parseint('四'));       // 4
Console.log(parseint('4'));       // 4

license

Creative Commons Licence

parseint is licensed under a Creative Commons Attribution 4.0 International License. No warranty whatsoever.

About

THE ultimate javascript function to parse strings (or even objects) to integers!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published