tgbotapi/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/String.kt

26 lines
359 B
Kotlin
Raw Normal View History

2019-01-23 04:15:57 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions
fun String.toMarkdown(): String {
return replace(
"*",
"\\*"
).replace(
"_",
"\\_"
)
}
2019-03-27 01:35:37 +00:00
fun String.toHtml(): String = replace(
"<",
"&lt;"
).replace(
">",
"&gt;"
).replace(
"&",
"&amp;"
).replace(
"\"",
"&quot;"
)