You can get either formatted or unformatted text from a Text or SystemTextItem object.
A heavily formatted string might return something like this:
Formatted \I\Technique\i\ \U\Text\n\\u\w\fPapyrus\\s181\it\f_\h\n\l\n\ine\n\\n\\n\\B\\I\feeds
Its unformatted equivalent would be
Formatted Technique Text with l ine feeds
Which loses the line feeds as well as the font changes, bold, etc.
Occasionally I want to process some text as if unformatted but retain the line feeds. Find and Replace Text does this for example, because it is hard to pattern match in something like
Here is a plugin that takes a formatted text string and strips out everything but the line feeds.
The method GetUnformattedTextWithLineFeeds takes a formatted sting and return one with no formatting and Chr(10) characters for the linefeeds.
You can use the result and use SplitString to get an array of text (\n\ does not work well as a separator for SplitString), as in
chNewSep = Chr(10); // ascii linefeed
arrNoTrim = SplitString(strLF, chNewSep, False);
arrTrim = SplitString(strLF, chNewSep, True);
where the TrimEmpty variable will get rid of multiple linefeeds or not.
SplitString array No Trim Empty:
"Formatted Technique Text"
SplitString array Trim Empty:
If you actually want just the text with \n\ for linefeeds, run
str1 = GetUnformattedTextWithLineFeeds(str0);
str2 = RestoreTextLinefeeds(str1);
The attached plugin has both these routine, and Run() will do some test runs on any selected text objects.
Feel free to use or modify this code as you wish.