Hi
Here's something I had to use to split a text field which had returns at the end of each line. I had to split the string into 4 separate strings in order to maniuplate each line separately. Here's the code I used to extract the third substring.
//1. Splits the string into substrings at each carriage return - each substring contains a single line of the original string.
//2. Only display the third substring, eg the third line of the original string
//3. replace the line feed at the beginning of this substring with a blank character
//(otherwise detail appears on second line of field)
//4. trim the left most character of the substring, so that it appears at the top of the field.
//Step 4 BEGIN - trim the leftmost character of the second substring you've created
ServiceRequest := trimleft (
//Step 3 BEGIN - replace the line feed at the beginning of the substring with a blank character
Replace (
//Step 1 BEGIN - If there are more than 3 carriage returns (eg 3 lines or more) split the string into substrings
if ubound(split({fieldname},Chr(13))) >= 3 then
//Step 2 BEGIN & END - only display the third substring
split({fieldname},Chr(13))[3] else "not recorded"
//Step 1 end
//Step 3 end
, chr(10) ," " )
//Step 4 end
);
I used this instead of an array (but it can be turned into one too).