我试图解决方案放在一起: Insert spaces between words on a camel-cased token字符替换在LINQ中?
本质上说,他希望把“ThisIsATest”到“这是一个测试”。我想,'哦,这很容易,我可以用LINQ来做,但我努力。
有人可以帮助我吗?
Dim s As String = String.Join("", From myChar As Char In myStr _
Select If(Char.IsUpper(myChar), (" " & myChar).ToString, myChar.ToString))
是我开始走下去的路径,但我无法将结果导入我可以使用的东西。我甚至添加了.ToString来尝试获取一个字符串数组,但是我仍然收到一个错误。
无法转换 类型的对象 'WhereSelectEnumerableIterator`2 [System.Char,System.String]' 为类型 'System.String []'。
我相信这意味着我得到System.Char,System.String而不是像我想要的System.String的集合。
我在做什么错?
你的问题是与http://stackoverflow.com/questions/323314/best-way-to-convert-pascal-case-to-a-句子相关。有很多不同的选择来解决你的问题。 – alex 2011-04-26 21:35:10
谢谢大家。看到它正确完成,这是有道理的。 – 2011-04-26 21:44:34