getRow Methode um zweistellige Zahlen erweitert

Anastasia Kisner 2024-01-04 17:40:21 +01:00
parent c66c40e340
commit 7472ee85e8
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import java.io.PrintWriter;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* A simplified spreadsheet class for the PR1 programming lab at Hochschule Mannheim. * A simplified spreadsheet class for the PR1 programming lab at Hochschule Mannheim.
* One aspect worth mentioning is that it only supports long numbers, not doubles. * One aspect worth mentioning is that it only supports long numbers, not doubles.
@ -62,6 +63,8 @@ public class Spreadsheet {
} }
private int getRow(String cellName) { private int getRow(String cellName) {
if(cellName.length()==3){
return Integer.parseInt(cellName.substring(1))-1;}
return cellName.charAt(1) - '1'; return cellName.charAt(1) - '1';
} }
@ -72,7 +75,7 @@ public class Spreadsheet {
* A method for reading in data from a CSV file. * A method for reading in data from a CSV file.
* @param path The file to read. * @param path The file to read.
* @param separator The char used to split up the input, e.g. a comma or a semicolon. * @param separator The char used to split up the input, e.g. a comma or a semicolon.
* @param starCellName The upper left cell where data from the CSV file should be inserted. * @param startCellName The upper left cell where data from the CSV file should be inserted.
* @return Nothing. * @return Nothing.
* @exception IOException If path does not exist. * @exception IOException If path does not exist.
*/ */