forked from hummel/PR1-Spreadsheet
Regex für fehlerhafte eingaben
parent
baa6d8a092
commit
f10415dec8
|
@ -18,6 +18,7 @@ public class Axel {
|
|||
spr.put("A3", "123");
|
||||
|
||||
spr.put("B9", "=41+A2+10-2/3");
|
||||
spr.put("B9", "2");
|
||||
|
||||
System.out.println("Schreibe 'stop' zum anhalten.");
|
||||
do{
|
||||
|
@ -28,8 +29,7 @@ public class Axel {
|
|||
System.out.println(spr);
|
||||
System.out.println("Befehl (z.B. D4_=7*6): ");
|
||||
command = input.nextLine();
|
||||
if(command.contentEquals("stop"))
|
||||
break;
|
||||
if(command.matches("[A-Za-z][1-9][0-9]?_=((([A-Za-z][1-9][0-9]?)|([0-9]+))(\\*|\\+|\\-|\\/))*(([A-Za-z][1-9][0-9]?)|([0-9]+))")) {
|
||||
for(int i = 0; i<command.length();i++) {
|
||||
if(command.charAt(i)=='_') {
|
||||
cellTRUE = false;
|
||||
|
@ -42,12 +42,14 @@ public class Axel {
|
|||
}
|
||||
}
|
||||
spr.put(cell, form);
|
||||
|
||||
}else if(command.matches("stop")){
|
||||
break;
|
||||
}else {
|
||||
System.out.println("Die Eingabe war nicht korrekt. Die Tabelle bleibt auf folgendem stand:");
|
||||
}
|
||||
}while(true);
|
||||
|
||||
spr.saveCsv("tmp/test.csv");
|
||||
|
||||
// TODO: You might want to put "UI loop" for entering value and formulas here resp. in some UI methods.
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue