getOrElse
Returns the substring from the given range if exist otherwise return else block.
Example:
"Hello".getOrElse(1..3) { "Hi" } // ell
"Hello".getOrElse(1..5) { "Hi" } // Hi
Content copied to clipboard
Since
1.1.0
See also
substring
IntRange
Returns the substring from the given progression if exist otherwise return else block.
Example:
"Hello".getOrElse(0..4 step 2) { "Hi" } // Hlo
"Hello".getOrElse(0..8 step 2) { "Hi" } // Hi
Content copied to clipboard
Since
1.1.0
See also
substring
IntProgression