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.
1 Answer
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 );
-
will it work using words like String str = 'an apple a day, keeps the doctor, away'?sfdclearner– sfdclearner2016-06-22 06:09:56 +00:00Commented Jun 22, 2016 at 6:09
-
@gelay it will split the
an apple a daythiskeeps the doctorandaway.. it will add 3 string in the listRatan Paul– Ratan Paul2016-06-22 06:11:39 +00:00Commented Jun 22, 2016 at 6:11 -
is there a .contains in apex trigger?sfdclearner– sfdclearner2016-06-22 06:31:00 +00:00Commented Jun 22, 2016 at 6:31
-
I didn't get you @gelayRatan Paul– Ratan Paul2016-06-22 06:32:23 +00:00Commented Jun 22, 2016 at 6:32
-
Let us continue this discussion in chat.sfdclearner– sfdclearner2016-06-22 06:37:24 +00:00Commented Jun 22, 2016 at 6:37
,that will return you list of string