在Tedit Delphi中更改角色 [英] Change character in Tedit Delphi

查看:115
本文介绍了在Tedit Delphi中更改角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我的英语不好。如果我在第一个TEdit中有文本 Kamu而在第二个TEdit中有 Dia文本,其中字符为 a,而在第三个TEdit中将其更改为 i,那么如何在TEdit中阻止字符?

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?

推荐答案

使用 StringReplace

NewValue := StringReplace(OldValue, 'a', 'i', [rfReplaceAll, rfIgnoreCase]);

您可能要忽略 rfIgnoreCase ,具体取决于您的需求。您可以使用其 Text 属性读取和写入 TEdit 控件的内容。例如:

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, ...);

这篇关于在Tedit Delphi中更改角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆