You need to sign in to do that
Don't have an account?
martin_wu
How to parse text line by line
Hi all,
I want to create a custom object with information from an incoming email that has a certain structure. For this purpose, I'd need to go through the body text of the email and parse it line by line. What is the best way of doing this?
Cheers,
Martin
Split it into an list with String.split('\n') and iterate over the list.
All Answers
Split it into an list with String.split('\n') and iterate over the list.
Cool, this works! Thanks a million. Here is the code in case anyone is interested:
List<String> allLines = new List<String>();
allLines = email.plainTextBody.split('\n');
for ( String line : allLines)
System.debug(line);
Cheers,
Martin