![]() |
![]() |
|
|
|||||||
| Programmierung Rat & Tat für Programmierer |
|
|
Themen-Optionen | Ansicht |
|
|
#16 |
|
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
Sorry, hab ich übersehen.
dein 2.Vorschlag würde wohl etwa so aussehen. Code:
float xKoord,yKoord;
//Hier muss noch irgendeine Überprüfung her, sonst könnte es eine Endlosschleife werden
while (input.length>1){
String t=input.substring(input.indexOf('(')+1,input.indexOf(')')-1);
try{
xKoord=Float.parseFloat(t.substring(0,t.indexOf(',')-1));
yKoord=Float.parseFloat(t.substring(t.indexOf(',')+1,t.length));
}
catch (NumberFormatException e){
throw new IllegalArgumentException("Ungueltiges Eingabeformat");
}
//irgendwas mit xKoord und yKoord machen
input=input.substring(input.indexOf(')')+1,input.length);
}
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
|
|
|
| Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|