All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.com.copperleaf.json.utils.encode.desktop.kt Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
package com.copperleaf.json.utils

import java.net.URLDecoder
import java.net.URLEncoder
import java.util.Base64

public actual fun String.urlEncode(): String {
    return URLEncoder.encode(this, Charsets.UTF_8)
}

public actual fun String.urlDecode(): String {
    return URLDecoder.decode(this, Charsets.UTF_8)
}

public actual fun String.base64Encode(): String {
    return Base64.getEncoder().encodeToString(this.toByteArray(Charsets.UTF_8))
}

public actual fun String.base64Decode(): String {
    return String(Base64.getDecoder().decode(this), Charsets.UTF_8)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy