1

I have a string ex.(a,b,c) which is inputted in a textarea(long). how can I convert it into array in apex trigger? Thanks in advance.

2
  • you need split the string with , that will return you list of string
    – Ratan Paul
    Jun 22, 2016 at 6:06
  • String ourString = 'Salesforce SE'; String[] stringCharacters = ourString.split(,); System.debug(stringCharacters); is it like this? Jun 22, 2016 at 6:07

1 Answer 1

1

You need to split the string using comma , that will return list.

String str = 'a,b,c';
List<String> lstString = str.split(',');
system.debug('---list of string---'+lstString );
5
  • will it work using words like String str = 'an apple a day, keeps the doctor, away'? Jun 22, 2016 at 6:09
  • @gelay it will split the an apple a day this keeps the doctor and away .. it will add 3 string in the list
    – Ratan Paul
    Jun 22, 2016 at 6:11
  • is there a .contains in apex trigger? Jun 22, 2016 at 6:31
  • I didn't get you @gelay
    – Ratan Paul
    Jun 22, 2016 at 6:32
  • Let us continue this discussion in chat. Jun 22, 2016 at 6:37

You must log in to answer this question.

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