Ragnar Lothbrok Posted December 15, 2018 Share Posted December 15, 2018 (edited) getPlayers().filter(p -> p.getName().toLowerCase().equals("nospace")); This works fine - the player if found if they're nearby. getPlayers().filter(p -> p.getName().toLowerCase().equals("name with space")); This seems to work randomly - some names work and others don't. Does anyone have any idea why that could be? Edited December 15, 2018 by Ragnar Lothbrok Quote Link to comment Share on other sites More sharing options...
ThatGamerBlue Posted December 15, 2018 Share Posted December 15, 2018 (edited) Some of the spaces are \u00a0 instead of a space, try this: p.getName().toLowerCase().replaceAll("\u00a0", " ").equals("other player") Edited December 15, 2018 by ThatGamerBlue Quote Link to comment Share on other sites More sharing options...
Ragnar Lothbrok Posted December 15, 2018 Author Share Posted December 15, 2018 8 minutes ago, ThatGamerBlue said: Some of the spaces are \u00a0 instead of a space, try this: p.getName().toLowerCase().replaceAll("\u00a0", " ").equals("other player") Why would some names be like this and not others - doesn't make much sense but I'll give it a go thanks! Quote Link to comment Share on other sites More sharing options...
Vilius Posted December 15, 2018 Share Posted December 15, 2018 (edited) 21 minutes ago, Ragnar Lothbrok said: Why would some names be like this and not others - doesn't make much sense but I'll give it a go thanks! Cause \u00a0 is a non breaking space, as in if its at the end of the line it blocks the text editor from breaking the word. In other words, non breaking space is counted as a part of the word. Also it should be username.replaceAll("\\u00a0", " ") because you need to escape the back slash. Edited December 15, 2018 by Vilius 1 Quote Link to comment Share on other sites More sharing options...