Extensions for kotlin.String

chomp

fun String.chomp(
    separator: String,
    onMissingDelimiter: () -> Pair<String, String>
): Pair<String, String>

Splits the given string into two parts before and after separator.

decodeBase64

fun String.decodeBase64(): String

decodeBase64Bytes

fun String.decodeBase64Bytes(): ByteArray

Decode String from base64 format

decodeBase64String

fun String.decodeBase64String(): String

Decode String from base64 format encoded in UTF-8.

encodeBase64

fun String.encodeBase64(): String

Encode String in base64 format and UTF-8 character encoding.

escapeHTML

fun String.escapeHTML(): String

Escapes the characters in a String using HTML entities

toCharArray

fun String.toCharArray(): CharArray

Convert String to CharArray

toLowerCasePreservingASCIIRules

fun String.toLowerCasePreservingASCIIRules(): String

Does the same as the regular toLowerCase except that locale-specific rules are not applied to ASCII characters so latin characters are converted by the original english rules.

toUpperCasePreservingASCIIRules

fun String.toUpperCasePreservingASCIIRules(): String

Does the same as the regular toUpperCase except that locale-specific rules are not applied to ASCII characters so latin characters are converted by the original english rules.