如何在c#中替换charecter [英] how to replace charecter in c#

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

问题描述

亲爱的朋友

i在TextBox.text中输入了一个单词as(ompra ??? h111)。

以及如何删除charecter(???)in这个字符串。

请给我解决方案。

dear friends
i have input a word as(ompra???h111) in TextBox.text .
and how to remove in charecter (???) in this string.
pls give me solutions.

推荐答案

如果这是你唯一的要求,那么你可以尝试一下。

If this is your only requirement, then you can try this.
string s = "ompra???h111";
string t = s.Replace("???", "");





如果你有各种数量的?字符这是一种更强大的方法。



If you can have various amount of ? characters this is a more robust approach.

string s = "ompra???h111";
string t = s.Replace("?", "");


string your_string= "ompra???h111";
string resulting_string= your_string.Replace("???", string.Empty);



这难吗? Atleast首先尝试自己的东西。



问候..


Is it that difficult? Atleast try something your self first.

Regards..


textBox1.Text = textBox1.Text.Replace("?",string.Empty);


这篇关于如何在c#中替换charecter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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