io.slink.string.strings-codec.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of slink-zero Show documentation
Show all versions of slink-zero Show documentation
Zero dependenices library to boost your Kotlin development
The newest version!
package io.slink.string
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
@OptIn(ExperimentalEncodingApi::class)
fun String.encodeBase64(): String {
return Base64.encode(this.toByteArray()).replace("=", "")
}
@OptIn(ExperimentalEncodingApi::class)
fun String.decodeBase64(): String {
return String(Base64.decode(this))
}