[英]Simplest way to split a string to a char array
Is there simplest way to split the word/sentence into every single char and store into array? 有没有最简单的方法将单词/句子拆分为每个字符并存储为数组?
Eg: Me and you. 例如:我和你。
array = { 'M', 'e', ' ', 'a', 'n', 'd', ' ', 'y', 'o', 'u', '.' 数组= {'M','e',','a','n','d',','y','o','u','。 }; };
好吧,这很简单:
"Me and you".ToCharArray();
Using String.ToCharArray
Method 使用String.ToCharArray
方法
https://msdn.microsoft.com/en-us/library/ezftk57x(v=vs.110).aspx https://msdn.microsoft.com/zh-CN/library/ezftk57x(v=vs.110).aspx
var chars = "Me and you.".ToCharArray();
This might be helpful 这可能会有所帮助
// Input string.
string value = "Me and you.";
// Use ToCharArray to convert string to array.
char[] array = value.ToCharArray();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.