If I have a string such as xAM - yPM
is it possible to split the string into 2 strings using the -
as the point where the string is split?
You can use the componentsSeparatedByString
function:
var splittedArray = yourString.componentsSeparatedByString(" - ")
println(splittedArray[0]) // "xPM"
println(splittedArray[1]) // "yPM"
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments