input:
myString = ""FILTER=(ID=123,Description=456)""
output:
FILTER, (ID=123,Description=456)
basically divide the string into two parts How can i achieve this ?
Want something equivalent to str.partition(sep) as in python
input:
myString = ""FILTER=(ID=123,Description=456)""
output:
FILTER, (ID=123,Description=456)
basically divide the string into two parts How can i achieve this ?
Want something equivalent to str.partition(sep) as in python
You want split with a limit parameter (but you don't get the separator as an element as in the Python partition)
val myString = "FILTER=(ID=123,Description=456)"
myString.split("=", 2)
//> res0: Array[String] = Array(FILTER, (ID=123,Description=456))
It's actually a java method - see here
The span-method could also be helpful for you
val myString = "FILTER=(ID=123,Description=456)"
//myString: String = FILTER=(ID=123,Description=456)
myString.span(_!='=')
//res9: (String, String) = (FILTER,=(ID=123,Description=456))