diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils/MessageUtils.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/MessageUtils.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/MessageUtils.java b/src/main/java/de/pixart/messenger/utils/MessageUtils.java index 8a3cdb707..78be415f7 100644 --- a/src/main/java/de/pixart/messenger/utils/MessageUtils.java +++ b/src/main/java/de/pixart/messenger/utils/MessageUtils.java @@ -31,11 +31,15 @@ package de.pixart.messenger.utils; import java.net.MalformedURLException; import java.net.URL; +import java.util.regex.Pattern; import de.pixart.messenger.entities.Message; import de.pixart.messenger.http.AesGcmURLStreamHandler; public class MessageUtils { + + private static final Pattern LTR_RTL = Pattern.compile("(\\u200E[^\\u200F]*\\u200F){3,}"); + private static final String EMPTY_STRING = ""; public static String prepareQuote(Message message) { final StringBuilder builder = new StringBuilder(); final String body = message.getMergedBody().toString(); @@ -79,4 +83,8 @@ public class MessageUtils { return false; } } + + public static String filterLtrRtl(String body) { + return LTR_RTL.matcher(body).replaceFirst(EMPTY_STRING); + } }
\ No newline at end of file |