Jump to content

torquish

Members
  • Posts

    6
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by torquish

  1. 4 minutes ago, Token said:

    Can’t check if that works as I’m on phone atm, but the idea is those weird characters should be in java’s horizontal whitespace character class, but not in the general whitespace class \s.

    P.S. Replace the double quote characters, I don’t have that on iphone keyboard

    Yes it works. Thanks.

  2. I am trying to get a Player's object from the specified name. What I have currently only works when the name doesn't contain a space. What am I doing wrong?

        private Player getPlayerObjectFromName(String name) {
            List<Player> players = getPlayers().filter(player -> player != null && player.getName().equalsIgnoreCase(name));
    
            if (players != null) {
                for (Player p : players) {
                    if (p.getName().equalsIgnoreCase(name)) {
                        return p;
                    }
                }
            }
            return null;
        }

    Edit: So I figured out the issue. Player objects use (char) 160 as a space which is why I was never getting a match when testing a name with (char) 32 as its space.

×
×
  • Create New...