[Email_TranslateBreakstoCRLF] is a utility method used by the email system to translate any combination of line feed and carriage return characters in a string to carriage return/line feed pairs.
The example below counts the number of line breaks in a string with a mixture of carriage returns and line feeds. We first use the [email_translatebreakstocrlf] method to unify all line breaks to carriage return/line feed pairs. We take the resulting string and split on the carriage return/line feed pairs to get an array whose size tells us the number of lines. We subtract one from that number because the last line won't have a line break, so the result will be the number of line breaks in the string.
email_translatebreakstocrlf('Line Feed\nCarriage Return\rEnd')->split('\r\n')->size - 1
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Posted on: 14 March 2011