Class StringSplitter.Shell
java.lang.Object
dev.sympho.modular_commands.utils.StringSplitter.Shell
- All Implemented Interfaces:
StringSplitter
,StringSplitter.Async
,Function<String,
List<String>>
- Enclosing interface:
- StringSplitter
A splitter that uses a shell-like splitting algorithm, where components are separated
by spaces, with the option of one or more components being delimited by quotes (single
or double) to allow for the inclusion of spaces.
Leading and trailing whitespace is ignored.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.StringSplitter
StringSplitter.Async, StringSplitter.Shell
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.StringSplitter.Async
StringSplitter.Async.Iterator
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.sympho.modular_commands.utils.StringSplitter
apply
Methods inherited from interface dev.sympho.modular_commands.utils.StringSplitter.Async
emptyIterator, iterate, split, splitAsync, spliterate, splitStream
-
Constructor Details
-
Shell
public Shell()Creates a new instance.
-
-
Method Details
-
delimiter
Description copied from interface:StringSplitter
Obtains a string that can be used to delimit two elements according to this splitter.Note that there is no guarantee that the value returned by this method is the only delimiter supported by this splitter, only that it is a valid delimiter.
In other words, the guarantee offered by this method is that, given some string
str
and splitterspl
, andl = spl.split(str)
, thenspl.split(String.join(spl.delimiter(), l)).equals(l)
istrue
.This implies that, for any sequence of strings
s1, s2, s3, ...
, thenspl.split(String.join(spl.delimiter(), s1, s2, s3, ...))
gives the same result as concatenatingspl.split(s1), spl.split(s2), spl.split(s3), ...
- Specified by:
delimiter
in interfaceStringSplitter
- Returns:
- The delimiter.
-
takeNext
Description copied from interface:StringSplitter.Async
Takes the next element from the current state.- Specified by:
takeNext
in interfaceStringSplitter.Async
- Parameters:
state
- The current processing state.sink
- The sink to send the next element into.- Returns:
- The new state.
-