如何忽略文本框中的大小写 [英] how to ignore case in textbox

查看:59
本文介绍了如何忽略文本框中的大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

Hi this is my code

MResult = MResult.Replace(txtSearch.Text, "<span style=\"color:#c1330e; padding:0px 2px 0px 2px\">" + txtSearch.Text + "</span>");



在这里,我给出txtSearch.Text.tolower()只需要小写字母oly.
从文字文本中选择我的文本框文本是唯一的

如果我给小写或大写,它想正确显示.



here i give txtSearch.Text.tolower() it takes only lowecase oly.
here from literal text am selecting my textbox text alone

if i give lowecase or uppercase it want to show correctly. how can it work for all case?

推荐答案

尝试如下操作.
Try as below.
string MResult = "hdshdjshdjsinputhdjshdjhdINPUTDHSJHDJInputdhsdjshdjhdj";
string search = txtSearch.Text;//"input"
string replaceWith = "1234";
MResult = System.Text.RegularExpressions.Regex.Replace(MResult, search, replaceWith, System.Text.RegularExpressions.RegexOptions.IgnoreCase);


一个文本框将以您输入的格式(即大写或小写)存储文本-因此您不会遇到任何问题.
只是默认文本框应该可以正常工作.
A textbox will store text in the format (i.e. upper or lower case) you enter - so you should not be facing any problems in this.
Just the default text box should work correctly.


这篇关于如何忽略文本框中的大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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