问题
Sorry for my bad english. How to block a character in TEdit if I have text 'Kamu' in first TEdit and 'Dia' in 2nd TEdit where character is 'a' and change them to 'i' in 3rd TEdit?
回答1:
Use StringReplace.
NewValue := StringReplace(OldValue, 'a', 'i', [rfReplaceAll, rfIgnoreCase]);
You may want to omit rfIgnoreCase
depending on your needs. You can read from and write to the content of the TEdit
control by using its Text
property. For instance:
Edit1.Text := StringReplace(Edit1.Text, ...);
来源:https://stackoverflow.com/questions/28961459/change-character-in-tedit-delphi