-
-
Save shuiRong/02e928cdfbe563dc3df18421c0b60ead to your computer and use it in GitHub Desktop.
telegram escape string | markdownv2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
var htmlEscaper = strings.NewReplacer( | |
"#", "\\#", | |
"-", "\\-", | |
"*", "\\*", | |
"[", "\\[", | |
"]", "\\]", | |
"(", "\\(", | |
")", "\\)", | |
"~", "\\~", | |
"`", "\\`", | |
">", "\\>", | |
"+", "\\+", | |
"-", "\\-", | |
"=", "\\=", | |
"|", "\\|", | |
"{", "\\{", | |
"}", "\\}", | |
".", "\\.", | |
"!", "\\!", | |
) | |
fmt.Println(htmlEscaper.Replace("科兴灭活病毒COVID-19疫苗在巴西的3期临床试验PROFISCOV研究数据:间隔14天打第二针有效率50.7%,预防中症率83.7%,防护重症率100%")) | |
} | |
// doc: https://core.telegram.org/bots/api#formatting-options |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment