Delphi function to convert Result of WrapText to TStringList
I use this function to insert carriage returns on a string so it is nicely formatted for emailing:
m := WrapText(m, #13#10, ['.',' ',#9,'-'], 60);
The problem is my email client has a 1023 character limit when processing strings. So if the original length of m is greater than 1023, it gets truncated (Note: the email client probably has events to handle this situation, but I think an easier approach is to just feed it strings less than the limit).
I am looking for a "WrapTextToStringList" function like this:
var mStringList: TStringList; begin mStringList := WrapTextToStringList(m, #13#10, ['.',' ',#9,'-'], 60);
So say I passed this a 220 character body of an email message. The results would be a string list with approximately 4 entries.
I think this just boils down to creating a function which parses a string at #13#10 into a string list.
Anyone got one?
TStringList already has a built-in method to parse a string at #13#10 into a string list.
MyStringList := TStringList.Create; MyStringList.Text := MyString;
This will populate the list by parsing the string and creating a new entry in the list whenever it finds a return.