Convert from type X to type YTag(s): Language


A string to integer
s = "12";
i = parseInt(s, 10);

OR

i = eval(s)

OR

i = s - 0;
An integer to a string
i = 12;
s = (i).toString();

or

s = "" + i;

(hex string)  s = "0x" + (i).toString(16);
(oct string)  s = "0"  + (i).toString(8);
(bin string)  s = (i).toString(2);

blog comments powered by Disqus