split
fun <EachT : Any, ValueT> NullableOption<EachT, ValueT>.split(regex: Regex, limit: Int = 0): OptionWithValues<List<ValueT>?, List<ValueT>, ValueT>
Change to option to take any number of values, separated by matched of a regex.
This must be called after converting the value type, and before other transforms.
Example:
val opt: List<Int>? by option().int().split(Regex(","))
Content copied to clipboard
Which can be called like this:
./program --opt 1,2,3
Parameters
limit
Non-negative value specifying the maximum number of substrings to return. Zero by default means no limit is set.
fun <EachT : Any, ValueT> NullableOption<EachT, ValueT>.split(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): OptionWithValues<List<ValueT>?, List<ValueT>, ValueT>
Change to option to take any number of values, separated by the delimiters.
This must be called after converting the value type, and before other transforms.
Example:
val opt: List<Int>? by option().int().split(",")
Content copied to clipboard
Which can be called like this:
./program --opt 1,2,3
Parameters
delimiters
One or more strings to be used as delimiters.
ignoreCase
true
to ignore character case when matching a delimiter. By default false
.
limit
The maximum number of substrings to return. Zero by default means no limit is set.