I'm playing with the new string toys. I'm getting something out of a CSV (and I have very good reason to need to do that).

I tried this: contents = contents.substringAfter('/n') and it's not finding anything. I know I have lots of '/n' in my file because contents.split('n', 2) throws up because the regex is too complicated.

Is there something I should be using instead of /n to denote a new line in a text file?

1 Answer 1


A newline is most commonly denoted by the escape character \n and not /n However, with CSV's, you may also want to check for \r\n as it will depend on the Operating System that is saving the file. Difference between '\n' and '\r\n'

string testString = 'Hello\nWorld';

16:43:16:021 USER_DEBUG [2]|DEBUG|World

You must log in to answer this question.

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