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

? Examples
TextUtils.SimpleStringSplitter(char delimiter)
Initializes the splitter.
Public Methods

? Examples
boolean hasNext()
Returns true if there is at least one more element, false otherwise.

? Examples
Iterator< String> iterator()
Returns an Iterator for the elements in this object.

? Examples
String next()
Returns the next object and advances the iterator.

? Examples
void remove()
Removes the last object returned by next from the collection.

? Examples
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
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.