I am having a problem with tokenizing "wddw". I can tokenize if they is a sign like (,). How can I tokenize this without getting an error. I have tried charAt(0), but it only gives me the first character.

I want each character to be stored separately. I know about split, but I need to use tokenizer

public static void main(String [] args)
    {
        String temp = "wddw";
StringTokenizer st = new StringTokenizer(temp);
while (st.hasMoreTokens())
{
    char del;
    String com = st.nextToken();
    int x = com.lastIndexOf(com);
    del = com.charAt(0);
    System.out.println(del);   
}

i think it is better to use character array to store each character and get it....sample syntax is like this.....

char[] i=new char[10];    String  u = (String) stoke.nextToken(); i= u.toCharArray();

So that you can get as each character.......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.