Weiß jemand, wie ich den String trennen kann und vor allem, wie ich an die Einzelteile herankomme?
Forum



Java - Stringtrennung
7 replies



Weiß jemand, wie ich den String trennen kann und vor allem, wie ich an die Einzelteile herankomme?
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html
vll klappt substring und indexOf
das hier hab ich noch schnell in google gefunden:
String stringZahl = "123";
int intZahl = Integer.parseInt(stringZahl);
damit solltest du es irgenwie hinbekommen, vll gibt es auch passende methoden dafür, musst du mal suchen
1
2
3
2
3
String rgb = "255,255,255"; String[] values = rgb.split(","); System.out.println("R: "+values[0]+" G: "+values[1]+" B: "+values[2]);

int r = Integer.parseInt(values[0]);

Ich denke, ich habs verstanden.



