I have string looking like this:
01
02
03
99
I’d like to parse these to make them into strings like:
1. 2. 3. 99. etc.
The numbers are a maximum of 2 characters. Also I have to parse some more numbers later in the source string so I would like to learn the substring equivalent in javascript. Can someone give me advice on how I can do. Previously I had been doing it in C# with the following:
int.Parse(RowKey.Substring(0, 2)).ToString() + "."
Thanks
Why,
parseIntof course.The other notes are that JavaScript is weakly typed, so
"a" + 1returns"a1". Additionally, for substrings you can choose betweensubstring(start, end)andsubstr(start, length). If you’re just trying to pull a single character,"abcdefg"[2]will return"c"(zero-based index, so 2 means the third character). You usually won’t have to worry about type-casting when it comes to simple numbers or letters.http://jsfiddle.net/mbwt4/3/