I have this script in PHP
// To prevent complications using scientific numbers less than 0 ex 7.2341232E-23
if (false !== ($cal = strpos($a, 'E-'))) { $a = 0; }
// Split $a so we only get the numbers before '.'
if (false !== ($cal = strpos($a, '.'))) { $a = substr($a, 0, $cal); }
I would like to know a simple way to make the same function in jQuery.. Any Ideas?
I did what you said... but before I go through and finish the rest of the script could you please tell me if this is right?
var a1 = a.indexOf("E-");
if (a1) { a = 0; }
var a2 = a.indexOf(".");
if (a2) { Math.floor(a); }
EDIT: I have now created a JS Fiddle that contains the script I have created based on your help.. thank you very much.. unfortunately something doesn't seem to work right.. Can Anybody please take a look at it, and tell me what is wrong?
String.indexOf()method.