aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/utils/TextUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/utils/TextUtils.java')
-rw-r--r--main/src/cgeo/geocaching/utils/TextUtils.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/utils/TextUtils.java b/main/src/cgeo/geocaching/utils/TextUtils.java
index 302a65d..14caf1d 100644
--- a/main/src/cgeo/geocaching/utils/TextUtils.java
+++ b/main/src/cgeo/geocaching/utils/TextUtils.java
@@ -153,4 +153,16 @@ public final class TextUtils {
return str.indexOf('<') != -1 || str.indexOf('&') != -1;
}
+ /**
+ * Remove all control characters (which are not valid in XML or HTML), as those should not appear in cache texts
+ * anyway
+ *
+ * @param input
+ * @return
+ */
+ public static String removeControlCharacters(final String input) {
+ Matcher remover = PATTERN_REMOVE_NONPRINTABLE.matcher(input);
+ return remover.replaceAll(" ").trim();
+ }
+
}