gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 03:51:23 25 4
gpt4 key购买 nike

我想要一些简单的东西,比如将 "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[] characters = "this is a test".ToCharArray();

关于c# - 将字符串拆分为单个字符的字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9846948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com