java - startsWith() not working properly with '§' character -
i have following code:
string checkmessage = arrays.stream(event.message.getformattedtext().split(" ")).filter(word -> !word.startswith("§") || word.startswith("§f")).collect(collectors.joining(" ")); system.out.println(checkmessage);
unfortunately testing, appears string contains words starting '§' not "§f" in output.
§r§928 §r§r§c§ltitan §r§esimplyanon§r §ftest§r
how happen?
it's java source file has different charset compared what's used compiler. use javac -encoding <source_file_encoding>
during compilation (for example, javac -encoding utf8
if source file utf-8) or save source file using system default encoding.
Comments
Post a Comment