Companion

object Companion

Contains static declarations for the EmailAddress type.

Properties

Link copied to clipboard
@DeprecatedAsErrorSince(version = KotoolsTypesVersion.V5_0_1)
const val PATTERN: String

The pattern that an email address should match.

Functions

Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_3)
fun orNull(text: String): EmailAddress?

Creates an instance of EmailAddress from the specified text, or returns null if the text doesn't match the default pattern.

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_3)
@DeprecatedAsErrorSince(version = KotoolsTypesVersion.V5_0_1)
fun orNull(text: String, pattern: String): EmailAddress?

Creates an instance of EmailAddress from the specified text. Returns null if the text doesn't match the specified pattern, or if the pattern doesn't match the default one.

@ExperimentalSince(version = KotoolsTypesVersion.V5_0_1)
fun orNull(text: String, regex: EmailAddressRegex): EmailAddress?

Returns an email address from the specified text, or returns null if the text doesn't match the specified regex.

Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_3)
fun orThrow(text: String): EmailAddress

Creates an instance of EmailAddress from the specified text, or throws an IllegalArgumentException if the text doesn't match the default pattern.

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_3)
@DeprecatedAsErrorSince(version = KotoolsTypesVersion.V5_0_1)
fun orThrow(text: String, pattern: String): EmailAddress

Creates an instance of EmailAddress from the specified text. Throws an IllegalArgumentException if the text doesn't match the specified pattern, or if the pattern doesn't match the default one.

@ExperimentalSince(version = KotoolsTypesVersion.V5_0_1)
fun orThrow(text: String, regex: EmailAddressRegex): EmailAddress

Returns an email address from the specified text, or throws an IllegalArgumentException if the text doesn't match the specified regex.