From 51af5b371c55bb0a49e0c9a4ac54e4dff90002d2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 18 Jan 2018 16:27:55 +0300 Subject: tg: markdown escape --- juick-core/src/main/java/com/juick/util/MessageUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'juick-core/src/main/java/com/juick/util') 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("`", "\\`"); + } } -- cgit v1.2.3