StringX extension

String null-safety helpers

on

Properties

isNullOrBlank bool

Available on String?, provided by the StringX extension

Returns true if string is null or blank (empty or only whitespace)
no setter
isNullOrEmpty bool

Available on String?, provided by the StringX extension

Returns true if string is null or empty
no setter

Methods

orDefault(String defaultValue) String

Available on String?, provided by the StringX extension

Returns string if not null or empty, otherwise defaultValue
orDefaultIfBlank(String defaultValue) String

Available on String?, provided by the StringX extension

Returns string if not null or blank, otherwise defaultValue