Hi,
I need to split a string into a character array in java. Can anyone help me. All I can find is splitting a string on spaces.
Thank you
Ozmodiar
splitting a java string into a character array
Moderator: General Moderators
The function you need takes the general form char[] toCharArray()
You can then search java.sun.com documentation for toCharArray for more examples.
Code: Select all
import java.io.*;
import java.lang.*;
public class ArrayTest
{
public static void main(String argsї]) throws Exception
{
String myString = "hello";
char myCharArrayї] = new charї10];
myCharArray = myString.toCharArray();
System.out.println(myCharArray);
System.exit(0);
}
}with google I found http://members.ozemail.com.au/~dcrombie/javascript/chap10.html. Sorry, usually I prefer http://selfhtml.teamone.de/ but it's in german.
edit: once again: I'm tooooooo slow
- You're probably looking for
- .charAt()
- .split()
- or even match()
edit: once again: I'm tooooooo slow