使用ASP.NET C#中的RegExp更正文本 [英] Correct text with RegExp in ASP.NET C#

查看:74
本文介绍了使用ASP.NET C#中的RegExp更正文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有人可以用正则表达式帮助我吗?

我有一些文字,我需要在开头用大写字母和点在结束。我从来没有在ASP.NET C#中使用regexp,这就是为什么我想在代码中有一些注释,如果可能的话。

谢谢

Hi,
Can somebody help me with the regexp?
I have some text and I need to correct it with capital letter in the beginning and with the dot in the end. I''ve never been using regexp in ASP.NET C# thats why I''d like to have some comments in the code if it''s possible.
Thanks

推荐答案

使用RegEx.Replace



http://www.dotnetperls.com/regex-replace [ ^ ]
Use RegEx.Replace

http://www.dotnetperls.com/regex-replace[^]




在这样的例子中你真的需要正则表达式吗?

也许你只能受限有这样的结构

System.Globalization.TextInfo.ToTitleCase()



for例如你有文字:

Hi,
Do you really need regex in such example ??
Maybe you can be bounded only with such construction
System.Globalization.TextInfo.ToTitleCase()

for example yo''ve got and text:
string s="hello world";
string capitalized=System.Globalization.TextInfo.ToTitleCase(s);





rezult将是:Hello world。



rezult will be: "Hello world".


这篇关于使用ASP.NET C#中的RegExp更正文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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