to top
Android APIs
public static class

TextUtils.SimpleStringSplitter

extends Object
implements TextUtils.StringSplitter Iterator<E>
java.lang.Object
   ↳ android.text.TextUtils.SimpleStringSplitter

Class Overview

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", "".

Summary

Public Constructors
TextUtils.SimpleStringSplitter(char delimiter)
Initializes the splitter.
Public Methods
boolean hasNext()
Returns true if there is at least one more element, false otherwise.
Iterator<String> iterator()
Returns an Iterator for the elements in this object.
String next()
Returns the next object and advances the iterator.
void remove()
Removes the last object returned by next from the collection.
void setString(String string)
Sets the string to split
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.text.TextUtils.StringSplitter
From interface java.lang.Iterable
From interface java.util.Iterator

Public Constructors

public TextUtils.SimpleStringSplitter (char delimiter)

Added in API level 1

Initializes the splitter. setString may be called later.

Parameters
delimiter the delimeter on which to split

Public Methods

public boolean hasNext ()

Added in API level 1

Returns true if there is at least one more element, false otherwise.

public Iterator<String> iterator ()

Added in API level 1

Returns an Iterator for the elements in this object.

Returns
  • An Iterator instance.

public String next ()

Added in API level 1

Returns the next object and advances the iterator.

Returns
  • the next object.

public void remove ()

Added in API level 1

Removes the last object returned by next from the collection. This method can only be called once between each call to next.

public void setString (String string)

Added in API level 1

Sets the string to split

Parameters
string the string to split