[英]Capitalize each word in string that has no spaces
I am trying to figure out if there are existing libraries/methods that would allow you to capitalize each word in a string, however the words have no spaces. 我试图弄清楚是否有现有的库/方法可以让您将字符串中的每个单词都大写,但是单词之间没有空格。 For example:
例如:
"blueparrot"
should be converted to "BlueParrot"
"blueparrot"
应转换为"BlueParrot"
I know that if there were spaces, I can accomplish this with: 我知道如果有空格,我可以使用以下方法完成此操作:
var textInfo = new CultureInfo("en-US", false).TextInfo;
textInfo.ToTitleCase("blue parrot");
However, without the spacing, the outcome is 但是,如果没有间隔,结果是
Blueparrot
Blueparrot
对于这个问题,没有简单的解决方案,只能说是将2个单词的字符串放在一起,这时您需要提供有关分词位置的信息,或对其进行适当的格式化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.