字符串函数 [英] string functions
本文介绍了字符串函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有字符串str ="Arts And Props"
现在我想用null替换字符串中的空格.
表示我想要结果为str ="ArtsAndProps"
I have string str="Arts And Props"
now i want to replace space in string with null.
means i want result as str="ArtsAndProps"
推荐答案
尝试 str.Replace(",string.Empty); 代码>
不,你错了.您想用一个空字符串替换该字符串.空是不同的东西.字符串类有一个Replace方法,用string.Empty替换",就可以完成.
No, you''re wrong. You want to replace the string with an empty string. Null is something different. The string class has a Replace method, replace " " with string.Empty and you''re done.
这篇关于字符串函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文