我如何将字符串转换为字符数组? [英] How can I convert a String to a char array?
本文介绍了我如何将字符串转换为字符数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有什么函数来完成这样的工作还是一个人均解析每个字符,并把它添加到阵列?
Is there any function to do this kind of job or do one have to parse each char and add it to the array?
推荐答案
使用<一个href=\"http://download.oracle.com/javase/6/docs/api/java/lang/String.html#toCharArray%28%29\"><$c$c>String#toCharArray()$c$c>.
char[] chars = "some string".toCharArray();
这篇关于我如何将字符串转换为字符数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文