of
Returns an email address with the specified text, or returns null if the text doesn't match EmailAddressRegex.Companion.default.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
assertNotNull(EmailAddress of "[email protected]")Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final EmailAddress result = EmailAddress.of("[email protected]");
Assertions.assertNotNull(result);Content copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V5_1_0)
Returns an email address with the specified text, or returns null if the text doesn't match the specified regex.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val text = "[email protected]"
val regex: EmailAddressRegex = EmailAddressRegex.alphabetic()
val result: EmailAddress? = EmailAddress.of(text, regex)
assertNotNull(result)Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final String text = "[email protected]";
final EmailAddressRegex regex = EmailAddressRegex.alphabetic();
final EmailAddress result = EmailAddress.of(text, regex);
Assertions.assertNotNull(result);Content copied to clipboard