createOrNull

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_0)
fun createOrNull(value: Any): NotBlankString?

Creates a NotBlankString from the string representation of the specified value, or returns null if its string representation is blank.

Here's an example of calling this function from Kotlin code:

val text: NotBlankString? =
NotBlankString.createOrNull("Kotools Types")
println(text) // Kotools Types

The NotBlankString type being an inline value class, this function is not available yet for Java users.

You can use the NotBlankString.Companion.create function for throwing an exception instead of returning null in case of invalid value.