Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
String s = "<?xml version="1.0" encoding="ISO-8859-1"?>
";
system.out.println(getTheUltimateAttributMethod(s));
http://pages.cs.wisc.edu/~hasti/cs302/examples/Parsing/parseString.html
oder halt mit nem stringtokenizer.
public static final String getEncodingFromFileContent(String content){
String[] a = content.split("\"");for(int i = 0; i<a.length; i++){if(a.contains("encoding=")){
return a[i+1];}}return null;}
zwei return-statements - nicht gut
Dann spar ich mir das break;
Was ist das Gegenargument? Bei so einer übersichtlichen Funktion verliert man sich ja eigentlich nicht im Code.
meinst du ein if und dann nen leeren string als rückgabewert, falls das gewünschte nicht existiert oder wie meinst du das, dass ihr das mit boolean umgesetzt hättet?
wenn du nur ne boolean statt nem string zurückgeben würdest, bräuchtest du ja ne globale variable und das ist jetzt auch nicht wirklich der hit, oder?!
public static final String getEncodingFromFileContent(String content){
String[] a = content.split("\"");String ret = null;for(int i = 0; i<a.length; i++){if(a.contains("encoding=")){
ret = a[i+1];break;}}return ret;}
Sowas hab ich ja noch nie gesehen
Dass es nicht ernst war, war schon klar.
Bei uns gibts auch noch die Vorgabe, dass Klassen nicht mehr als 40 Zeilen Code haben dürfen (mit allen Methoden und Attributen).
Yes, unter 300 geht bei mir gar nichts -.-
da biste ja nur am klassen hin und herspringen.
�N�a�m�e�,�G�i�v�e�n� �N�a�m�e
usw.
public static void main(String[] args) {
Internationalizer c = new Internationalizer();
c.readData();
c.printData();
}
public void readData() {
try {
FileReader file = new FileReader("C:\\me\\Temp\\google.csv");
BufferedReader data = new BufferedReader(file);
while ((zeile = data.readLine()) != null) {
split = zeile.split(";");
for(int i=0; i<split.length; i++) {
//leere Zeilen ignorieren
if( !(split[i].equals("")) )
//eventuelle Leerzeichen zwischen zwei ';' entfernen
//und Wert in Liste schreiben
list.add(split[i].trim());
}
}
} catch (FileNotFoundException e) {
System.out.println("Datei nicht gefunden");
} catch (IOException e) {
System.out.println("E/A-Fehler");
}
}
public void printData() {
int max = list.size();
for(int i=0; i<max; i++) {
System.out.println(list.get(i));
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.