com.lightningkite.lightningserver.email.EmailLabeledValue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-core Show documentation
Show all versions of server-core Show documentation
A set of tools to fill in/replace what Ktor is lacking in.
The newest version!
package com.lightningkite.lightningserver.email
import kotlinx.serialization.Serializable
@Serializable
data class EmailLabeledValue(
val value: String,
val label: String = ""
) {
companion object {
fun parse(raw: String) =
EmailLabeledValue(label = raw.substringBefore('<', "").trim(), value = raw.substringAfter('<').substringBefore('>').trim())
}
override fun toString(): String = "$label <$value>"
}