allow new line in message

This commit is contained in:
2026-07-09 10:29:34 +07:00
parent 7a44e836a9
commit c3112677b6
2 changed files with 9 additions and 5 deletions

View File

@@ -10,14 +10,10 @@ fun PublicKey.short(): String {
val URL_REGEX = Regex("(https?://\\S+)", RegexOption.IGNORE_CASE)
private val imageExtensions = setOf("jpg", "jpeg", "png", "gif", "webp", "bmp")
fun String.extractUrls(): List<String> {
return URL_REGEX.findAll(this).map { it.value }.toList()
}
fun String.removeImageUrls(): String {
return URL_REGEX.replace(this) { result ->
if (result.value.isImageUrl()) "" else result.value
}.replace(Regex("\\s+"), " ").trim()
}.trim()
}
fun String.isImageUrl(): Boolean {