Einzelnen Beitrag anzeigen
Alt 02.01.2004, 19:42   #17
jak
Inventar
 
Registriert seit: 13.06.2001
Beiträge: 1.830


Standard

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);
}
Jak
____________________________________
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)
jak ist offline   Mit Zitat antworten