小编典典

将字符串拆分为单个字符的字符串数组

c#

我想一些简单的转"this is a test"

new string[] {"t","h","i","s"," ","i","s"," ","a"," ","t","e","s","t"}

我真的需要做些什么

test = "this is a test".Select(x => x.ToString()).ToArray();

编辑:澄清一下,我不需要一个char数组,理想情况下,我想要一个字符串数组。除了我认为有一种更简单的方法外,我实际上没有发现上述代码有什么问题。


阅读 243

收藏
2020-05-19

共1个答案

小编典典

我相信这就是您要寻找的:

char[] characters = "this is a test".ToCharArray();
2020-05-19