Add method for standardizing text input to Text

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-10-04 15:35:06 +02:00
parent bd15098863
commit 7bb5dc470c

View File

@@ -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();
}
}