MyChat Scripts: property TStringList.DelimitedText, list text divided by a special character
Syntax
property TStringList.DelimitedText: string;
Result
Text string. If nothing is in the list, the property returns an empty string.
Example
Calculating the number of the word "love" in the song lyrics and displaying line numbers with these words.
const
FILENAME = 'C:\text\Lena Meyer-Satellite.txt';
var
SL, SLOut: TStringList;
s: string;
i: integer;
begin
SL := TStringList.Create;
SL.LoadFromFile(FILENAME);
SLOut := TStringList.Create;
for i := 0 to SL.Count - 1 do
if pos('love', LowerCase(SL[i])) <> 0 then SLOut.Append(IntToStr(i));
SLOut.Delimiter := '|';
mLogScript(SLOut.DelimitedText, 'Lines with "love" word');
SL.Free;
SLOut.Free;
end.
Script work result
[18:01:12] (Log "DelimiterProperty"): [Lines with "love" word] 5|8|10|13|18|20|25|30|33|40|43|53|58|61|68|71
[18:01:12] (Run "DelimiterProperty"): Script operation time: 8 ms
[18:01:12] (Run "DelimiterProperty"): Script done successfully.