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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -