- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi Memo1 字符串快速查找定位2
Memo1.WordWrap:= False;
function TForm1.FindText( const aPatternToFind: String):Boolean;
var
p: Integer;
begin
p := pos(aPatternToFind, Memo1.Text);
Result := (p > 0);
if Result then
begin
Memo1.SelStart := p;
Memo1.SelLength := Length(aPatternToFind);
Memo1.SetFocus; // necessary so highlight is visible
end;
end;