EmailAddress
@ExperimentalSince(version = KotoolsTypesVersion.V4_4_0)
@Serializable(with = EmailAddressSerializer::class)
Represents an email address.
You can use the EmailAddress.Companion.create or the EmailAddress.Companion.createOrNull functions for creating an instance of this type.
Serialization and deserialization
The serialization and deserialization processes of this type behave like for the String type.
Here's an example of Kotlin code that encodes and decodes this type using the JavaScript Object Notation (JSON) format from kotlinx.serialization:
val address: EmailAddress = EmailAddress.create("[email protected]")
val encoded: String = Json.encodeToString(address)
println(encoded) // "[email protected]"
val decoded: EmailAddress = Json.decodeFromString(encoded)
println(decoded == address) // true
Content copied to clipboard
Types
Link copied to clipboard
object Companion
Contains static declarations for the EmailAddress type.