How do I split text by "," and get rid of the "," in java?

Posted by Jack Null on Stack Overflow See other posts from Stack Overflow or by Jack Null
Published on 2010-04-21T17:51:23Z Indexed on 2010/04/21 17:53 UTC
Read the original article Hit count: 109

Filed under:

I want to split and get rid of the comma's in a string like this that are entered into a textfield:

1,2,3,4,5,6

and then display them in a different textfield like this:

123456

here is what i have tried.

   String text = jTextField1.getText();

    String[] tokens = text.split(",");
    jTextField3.setText(tokens.toString());

© Stack Overflow or respective owner

Related posts about java