I have a string in the form of myText = "1000 - abc 123 xyz"
When I do myText.split(" - ")(0)
I get the value 1000, but myText.split(" - ")(1)
I get the value "-", and myText.split(" - ")(2)
= "abc"
If I remove the spaces so myText = "1000-abc 123 xyz"
, myText.split("-")(1)
= "abc 123 xyz" as required.
Thought the split character was not included in the array, and why are the spaces influencing the outcome when the are part of the split value.