From 7bb5dc470c8652ee290fda8760d9613744381740 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 4 Oct 2018 15:35:06 +0200 Subject: [PATCH] Add method for standardizing text input to Text Signed-off-by: Tomas Slusny --- .../src/main/java/net/runelite/client/util/Text.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/util/Text.java b/runelite-client/src/main/java/net/runelite/client/util/Text.java index 6b7f953d2e..dd40bad1d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/Text.java +++ b/runelite-client/src/main/java/net/runelite/client/util/Text.java @@ -45,4 +45,13 @@ public class Text return TAG_REGEXP.matcher(str).replaceAll(""); } + /** + * In addition to removing all tags, replaces nbsp with space, trims string and lowercases it + * @param str The string to standardize + * @return The given `str` that is standardized + */ + public static String standardize(String str) + { + return Text.removeTags(str).replace('\u00A0', ' ').trim().toLowerCase(); + } }