splitting a string by every character
in
Programming Questions
•
3 years ago
hello..
I've got a textfield (programmed on my own) where I want users to give in some text. If this text is typed in, it should be shown there but still be changeable.
in the textfield class I work with separate characters. When a key is pressed, a new character is added. If the submit-button is pressed, I join these characters to one and give it out. So far no problems..
I use the textfield to add new objects for example a point or a triangle. for all the points there are the same two textfields (one for the name, the other for the coordinates--> the coordinates I split by "," and there's no problem).
If the text has been submitted, a new object is added and the text is deleted because the textfield is like I said used for all the other objects as well.
But if I select an object, I'd like the coordinates and the name to be shown.. It isn't stored in the textfield (that's because the values are changeable without typing a number but with dragging it around on the screen). So there has the actual value to be written there, a float or a string value. No problem so far, but hence it should be changeable it has to be splitted by every character. But if I split a string by:
String split1[]=(myString,"");
String split1[]=(myString,"");
the program crashes ;)
any ideas how to split a string (or a float) by every character??
or is there an easier possibility I don't see?
1