I am confused to get a particular word started line in Memo in Delphi 7
I have something like this
Memo1.lines.text:= *Some execution process*;
and the result in Memo1 is
I have something to do
I have never gone there
We are playing Tenis
You are so sweet
I am going there
Now How can I get only the line started with We instead of whole bunch of lines
like in the above Memo lines
We are playing Tenis
If you know you always want a specific line (like the third in your sample), access it directly.
Lines
, likeTStringList
, is zero-based, so subtract one:If you only have part of the text at the beginning of the line, you can iterate through each line and use
StrUtils.StartsText
:In Delphi 7, use
AnsiStartsText
instead (also found in theStrUtils
unit).