Re: [Pauker-discussion] Eine Datei läßt sich nicht mehr öffnen
Brought to you by:
axel77,
ronnystandtke
From: Ronny S. <Ron...@gm...> - 2008-10-05 09:58:58
|
Hallo Marc-André > Hier mal ein Lösungsvorschlag, der auch bei früheren Versionen > funktionieren sollte: > > public static String filter(String str) { > char[] neu = new char[str.length()]; > char aktuell; > int naechstePosition = 0; > > for(int i = 0; i<str.length(); i++) { > aktuell = str.charAt(i); > if((aktuell >= '\u0020' && aktuell <= '\uD7FF') || aktuell == > '\u0009' || aktuell == '\n' || aktuell == '\r' || (aktuell >= '\uE000' > && aktuell <= '\uFFFD') ) { > neu[naechstePosition++] = aktuell; > } > } > > return new String(neu,0,naechstePosition); > } > > Diese Methode kann alle unerwünschten Zeichen rausfiltern, bevor die > Zeichenketten in einer Lektion übernommen werden. > > Ich habe die Funktion nur sehr grob getestet. Falls sie in Pauker > übernommen werden sollte, müsste sie also noch getestet werden. Außerdem > sollte noch mal jemand nachgucken, ob die angegebenen Bereiche so > wirklich passen, nicht dass ich dort jetzt einen Fehler eingebaut habe. > Den Bereich [#x10000-#x10FFFF] habe ich nicht eingegeben, ich glaube so > große Werte kann Java nicht mehr verarbeiten. Vielen herzlichen Dank für deinen Vorschlag! Ich habe ihn vor ein paar Tagen in Pauker eingearbeitet. Siehe ganz am Ende hier: http://pauker.cvs.sourceforge.net/viewvc/pauker/project/src/pauker/program/Pauker.java?view=markup Eine neue Testversion habe ich auch wieder hochgeladen. Link: http://pauker.sourceforge.net/webstart/pauker_testing.jnlp Ich hoffe, wir haben mit dem Patch nichts anderes kaputt gemacht. Die Unit-Tests laufen jedenfalls noch alle tadellos. Bitte nochmal ausgiebig testen. Die v1.8 ist schon viel zu lange im RC-Stadium, ich würde dann gerne mal eine finale Release machen, schliesslich ist jetzt wirklich alles, inklusive Doku, erledigt. Viele Grüsse Ronny |