Page Summary
-
TextUtils.SimpleStringSplitteris a utility class in Android for splitting strings based on a delimiter. -
It provides methods like
hasNext(),next(), andsetString()to iterate through the split parts of the string. -
If the string ends with the delimiter, it does not return an empty string at the end.
-
The
SimpleStringSplitteris initialized with the delimiter character and the string to be split is set usingsetString().
implements TextUtils.StringSplitter Iterator<String>
A simple string splitter.
If the final character in the string to split is the delimiter then no empty string will be returned for the empty string after that delimeter. That is, splitting "a,b," on comma will return "a", "b", not "a", "b", "".
Public Constructor Summary
|
SimpleStringSplitter(char delimiter)
Initializes the splitter.
|
Public Method Summary
| boolean |
hasNext()
|
| Iterator<String> |
iterator()
|
| String |
next()
|
| void |
remove()
|
| void |
setString(String string)
Sets the string to split
|
Inherited Method Summary
Public Constructors
public SimpleStringSplitter (char delimiter)
Initializes the splitter. setString may be called later.
Parameters
| delimiter | the delimeter on which to split |
|---|
Public Methods
public boolean hasNext ()
public Iterator<String> iterator ()
public String next ()
public void remove ()
public void setString (String string)
Sets the string to split
Parameters
| string | the string to split |
|---|