var sVar = "someString";
I tried sVar.toString(36) as inferred from num.toString(2). But it doesn't work.
I know to convert from base64 you use atob/btoa but I could not find for base 36. Maybe there is a variant for this that does it?
Join Stack Overflow to learn, share knowledge, and build your career.
var sVar = "someString";
I tried sVar.toString(36) as inferred from num.toString(2). But it doesn't work.
I know to convert from base64 you use atob/btoa but I could not find for base 36. Maybe there is a variant for this that does it?
You can use parseInt to convert a string to a base-36 integer.
var myString = "somestring";
var myNum = parseInt(myString, 36); /* 2913141654103084 */
And you can use .toString to convert back to a string.
myNum.toString(36) /* "somestring" */
Both functions take a numeric "radix" (an integer between 2 and 36 specifying the base to use for representing numeric values) as a parameter, which should be 36 for base-36.
15bfi0 for string aww .. can you explain it..
– Muhammad Umer
Feb 14 '15 at 4:49
sVarhas string – Muhammad Umer Feb 14 '15 at 4:21sVarhere? – jdphenix Feb 14 '15 at 4:22