fixing file derivation algorithm

This commit is contained in:
Maxmtg
2012-03-02 17:54:22 +00:00
parent cebd3d28ed
commit 59a76ac222

View File

@@ -139,14 +139,7 @@ public abstract class DeckBase implements Serializable, Comparable<DeckBase> {
* @return the best file name * @return the best file name
*/ */
public final String getBestFileName() { public final String getBestFileName() {
final char[] c = this.getName().toCharArray(); return this.getName().replaceAll("[^-_$#@.{[()]} a-zA-Z0-9]", "");
final StringBuilder sb = new StringBuilder();
for (int i = 0; (i < c.length) && (i < 20); i++) {
if (Character.isLetterOrDigit(c[i]) || (c[i] == '-')) {
sb.append(c[i]);
}
}
return sb.toString().replaceAll("[^-_$#@.{[()]} a-zA-Z0-9]", "");
} }
} }