I have a sti开发者_运维问答ng like this "hello" -- I want to divide the characters into h,e,l,l,o
How can I do this in Java? By using StringTokenizer? Any other suggestions?
How about String.toCharArray() ?
Why do you need to use the StringTokenizer?
I would read the String API for a method that allows you to get a character from the String.
Use this code
String str = "testing";
String [] temp = null;
temp = str.split("");
for (int i = 0 ; i < temp.length ; i++) {
System.out.println(temp[i]);
}
加载中,请稍侯......
精彩评论