aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src/main/java/com/juick/util
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-01-18 16:27:55 +0300
committerGravatar Vitaly Takmazov2018-01-18 16:27:55 +0300
commit51af5b371c55bb0a49e0c9a4ac54e4dff90002d2 (patch)
treed636714434b1554d2ce0f9a12a6e7d8b1d117e6a /juick-core/src/main/java/com/juick/util
parent230e5e80d9b1e3ca4535fb0dbba19246d799a737 (diff)
tg: markdown escape
Diffstat (limited to 'juick-core/src/main/java/com/juick/util')
-rw-r--r--juick-core/src/main/java/com/juick/util/MessageUtils.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/juick-core/src/main/java/com/juick/util/MessageUtils.java b/juick-core/src/main/java/com/juick/util/MessageUtils.java
index 6e0b47c0..fa0072b2 100644
--- a/juick-core/src/main/java/com/juick/util/MessageUtils.java
+++ b/juick-core/src/main/java/com/juick/util/MessageUtils.java
@@ -193,4 +193,10 @@ public class MessageUtils {
}
return ret;
}
+ public static String escapeMarkdown(final String s) {
+ return s.replace("_", "\\_").replace("*", "\\*")
+ .replace("~", "\\~").replace("[", "\\[")
+ .replace("]", "\\]").replace("(", "\\(")
+ .replace(")", "\\)").replace("`", "\\`");
+ }
}