Need to split a string by first occurence of specific character like
'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.
String.split(regExp, limit) method:
Returns a list that contains each substring of the String that is terminated by either the regular expression regExp or the end of the String.
String str = 'this-is-test-data'; List<String> res = str.split('-', 2); System.debug(res);
15:16:58:001 USER_DEBUG |DEBUG|(this, is-test-data)