comparison lib/js/urweb.js @ 1631:747f94ac5fc2

Make last change nicer
author Adam Chlipala <adam@chlipala.net>
date Sun, 04 Dec 2011 15:18:41 -0500
parents 4798ad652c94
children 4682b312e9d5
comparison
equal deleted inserted replaced
1630:4798ad652c94 1631:747f94ac5fc2
967 return s.substring(i); 967 return s.substring(i);
968 else 968 else
969 return s; 969 return s;
970 } 970 }
971 971
972 if (s == "0") 972 if (s.length == 0)
973 return s; 973 return s;
974 else 974 else
975 return {}; 975 return "0";
976 } 976 }
977 977
978 function pi(s) { 978 function pi(s) {
979 s = trimZeroes(s); 979 var st = trimZeroes(s);
980 var r = parseInt(s); 980 var r = parseInt(st);
981 if (r.toString() == s) 981 if (r.toString() == st)
982 return r; 982 return r;
983 else 983 else
984 er("Can't parse int: " + s); 984 er("Can't parse int: " + s);
985 } 985 }
986 986
991 else 991 else
992 er("Can't parse float: " + s); 992 er("Can't parse float: " + s);
993 } 993 }
994 994
995 function pio(s) { 995 function pio(s) {
996 s = trimZeroes(s); 996 var st = trimZeroes(s);
997 var r = parseInt(s); 997 var r = parseInt(st);
998 if (r.toString() == s) 998 if (r.toString() == st)
999 return r; 999 return r;
1000 else 1000 else
1001 return null; 1001 return null;
1002 } 1002 }
1003 1003