+ Start a Discussion

Can Split function be used on a String of Array ?

I would like to use split on a string of Array . for example , i have arrMonth[] array with strings , 'Jan','Feb','Mar' ... 'Dec'.
I wish to split arrMonth[] into 2 sub arrays by means of index position .. when i try using Splice/slice method in salesforce its throwing an error stating
"Method does not exist or incorrect signature: [LIST<String>].splice(Integer, Integer)"

Looking for Split function on string of array or any other alternative way to achieve this w/o manual declaration of 2 sub arrays
Any pointers would be great

thanks in advance

Best Answer chosen by Admin (Salesforce Developers) 
Jeff MayJeff May

Each element in the String array can be split(), but you can't split() across strings.  You can use an index offset or a for loop to iterate over the string array and assign strings to different arrays: