Need to split a string by first occurence of specific character like '-'
in 'this-is-test-data'
. so what i want is when i do split it will return 'this' in zero index and rest in first index.
Need to split a string by first occurence of specific character like '-'
in 'this-is-test-data'
. so what i want is when i do split it will return 'this' in zero index and rest in first index.
Best Answer
Use
String.split(regExp, limit)
method:Documentation says
Example:
Result: