java - Should be returning true but returns false instead? -


code:

bukkit.getserver().broadcastmessage("check " + chatcolor.stripcolor(i)); bukkit.getserver().broadcastmessage("that starts " + chatcolor.stripcolor(chatcolor.translatealternatecolorcodes('&',      guishop.instance.getconfig().getstring("messages." + type + "label")))); bukkit.getserver().broadcastmessage(chatcolor.stripcolor(i).startswith(chatcolor.stripcolor(chatcolor.translatealternatecolorcodes('&', guishop.instance.getconfig().getstring("messages." + type + "label")))) + ""); 

and image of returning false instead of true: enter image description here

could me being stupid.. not sure

edit1: ok eckes pointed out being stupid.. how check if "buy: 50.0" started "buy: price". if %price%

false correct, "buy: 50.0" not start "buy: %price%". , should not mix color logic translation logic business logic.

make code readable, helps find problem yourself.

if want remove %price% use:

string check = chatcolor.stripcolor(i); string pattern = chatcolor.stripcolor(chatcolor.translatealternatecolorcodes('&',                       guishop.instance.getconfig().getstring("messages." + type + "label"))); pattern = pattern.replace(" %price%", ""); boolean isbuy = check.startswith(pattern); 

i cant make more readable without more background details.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -