How do I put the characters of a string into an array?
public class Draw(String s){
//turn s into array here
}
Plz & thanks
Moderator: Moderators
Code: Select all
char[] charArray = new char[s.length()]; //s.length gives the exact number of fields in the string. Any number can be used.
charArray = s.toCharArray();Life of Brian wrote:I'll be honest with you - I would have never guessed that.RYW wrote:RYW:
Rare
Yellow
Weasel
Code: Select all
String s = "hello"
s.charAt(1); // should =='e'