String s = 'a b c d e f g h i j k l m';

above code returns (, a, , b, , c, , d, , e, ...)

am I missing something? Please help

  • As per my understanding, you want to split the string by white space. But in split method you've mentioned '', which is different. Try s.split(' '). Also note that you cannot print the whole list in system.debug if the list is long enough. Try printing the list elements in for loop.
    – Abbas
    Commented May 28, 2015 at 11:44

1 Answer 1


I think its issue with logs which shows "..." after some text. Please try this:

String s = 'a b c d e f g h i j k l m';
for(String s1 : s.split(' ')){
    System.debug('value ' + s1);

Hope this will show you all values.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .