Add support for link generated by matrix.to website.
This commit is contained in:
parent
4dfec7ac55
commit
1bcfa6034c
5 changed files with 63 additions and 2 deletions
|
|
@ -58,3 +58,15 @@ fun String.ellipsize(length: Int): String {
|
|||
|
||||
return "${this.take(length)}…"
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the old prefix with the new prefix.
|
||||
* If the string does not start with the old prefix, the string is returned as is.
|
||||
*/
|
||||
fun String.replacePrefix(oldPrefix: String, newPrefix: String): String {
|
||||
return if (startsWith(oldPrefix)) {
|
||||
newPrefix + substring(oldPrefix.length)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue