本文介绍了显示和字符串中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在打印和字符串方面遇到问题
例如:
字符串Test ="This是示例&练习"
但是当在标签中打印该字符串时,它显示为
这是示例
&未打印在标签中
任何人都可以帮忙.
I have problem in printing & in string
Eg :
string Test="This is the example & excercise "
but while print that string in lable it shows as
This is the example
& is not printed in label
Any one help pls.
推荐答案
label1.UseMnemonic=false;
label1.Text="This is the example & excercise";
//will show you same string as you assign in text property.
2.替换为&"并替换为&&".
2. Replace with ''&'' with ''&&''.
label1.Text="This is the example & excercise".Replace("&","&&");
祝您编码愉快!
:)
Happy Coding!
:)
string Test = "This is the example && excercise ";
label1.Text = Test;
string Test="This is the example && excercise "
或者,如果是输入字符串,则使用replace
or if it is kind of input string , then use replace
string Test="This is the example & excercise "
Test.Replace("&","&&")
这篇关于显示和字符串中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!