diff options
Diffstat (limited to 'juick-core/src/main/java/com/juick/util')
-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("`", "\\`"); + } } |