How to split string in typescript ionic?


#1

I have a variable string with value like this : "-34.9290,138.6010"
and now I want to split to two variable, one varible to save “-34.9290” and one to save "138.6010"
can someone help me?
I try substring & indexOf function, but when running on device its not working


#2

You can just use normal Javascript functions, so the best option here would be to use:

"-34.9290,138.6010".split(',');

which will return an array of the two values.