diff options
author | 2018-01-18 16:27:55 +0300 | |
---|---|---|
committer | 2018-01-18 16:27:55 +0300 | |
commit | 51af5b371c55bb0a49e0c9a4ac54e4dff90002d2 (patch) | |
tree | d636714434b1554d2ce0f9a12a6e7d8b1d117e6a /juick-core/src/main/java/com/juick/util/MessageUtils.java | |
parent | 230e5e80d9b1e3ca4535fb0dbba19246d799a737 (diff) |
tg: markdown escape
Diffstat (limited to 'juick-core/src/main/java/com/juick/util/MessageUtils.java')
-rw-r--r-- | juick-core/src/main/java/com/juick/util/MessageUtils.java | 6 |
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("`", "\\`"); + } } |