Possible Duplicate:
How do I split this string with JavaScript?
In my rails app i’m concatenating strings and sending it to javascript via ajax technology. But for encreasing speed i think about one method…
So simple i need to slice my string to three variables:
My string look’s so:
5.21o-o11.0o-o4
So how to slice it to
5.21
11.0
4
?
Assuming
o-ois the delimiter, usesplit()to get it into an array:This is obviously an example. Normally to get the values out you would iterate over the array as required.