createOrNull
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
Creates a NotBlankString from the string representation of the specified value, or returns null
if its string representation is blank.
Calling from Kotlin
Here's an example of calling this method from Kotlin code:
val actual: NotBlankString? =
NotBlankString.createOrNull("Kotools Types")
assertNotNull(actual)
Content copied to clipboard
The NotBlankString type being an inline value class, this method is not available yet for Java users.
You can use the NotBlankString.Companion.create method for throwing an exception instead of returning null
in case of invalid value.