14-09-2014, 08:16 PM
14-09-2014, 11:49 PM
في الحدث OnChange لـ Memo أو RichEdit
ضع شي مثل
ضع شي مثل
PHP كود :
var
SL: TStringList;
begin
SL := TStringList.Create;
try
SL.Delimiter := ' ';
SL.DelimitedText := Memo1.Text; // or SL.DelimitedText := RichEdit1.Text;
if SL.Count > 0 then
Caption := SL[Pred(SL.Count)];
finally
SL.Free;
end;
end;
15-09-2014, 10:13 AM
السلام عليكم
طريقة اخرى اخر كلمتين اتركها لك :confused:
طريقة اخرى اخر كلمتين اتركها لك :confused:
PHP كود :
function TForm1.LastWord(Value: String): String;
begin
// get the last line
Value := Copy(Value, LastDelimiter(#13#10, Value), Length(Value));
// get the last word
Result := Trim(copy(Value, LastDelimiter(' ',Value), Length(Value)));
end;
procedure TForm1.Memo1Change(Sender: TObject);
begin
if not (LastWord(Memo1.Text) = EmptyStr) then
Caption := LastWord(Memo1.Text);
end;