# TextUtils.SimpleStringSplitter

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#pubctors)\|[Methods](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#inhmethods)  

# TextUtils.SimpleStringSplitter

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter "View this page in Kotlin")\|Java

`
public
static


class
TextUtils.SimpleStringSplitter
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Iterator](https://developer.android.com/reference/java/util/Iterator)`<`[String](https://developer.android.com/reference/java/lang/String)`>,

`[TextUtils.StringSplitter](https://developer.android.com/reference/android/text/TextUtils.StringSplitter)`


`

|---|---------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.text.TextUtils.SimpleStringSplitter |

<br />

*** ** * ** ***

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 delimiter. That is, splitting"a,b,"on comma will return"a", "b", not"a", "b", "".

## Summary

|                                                                                  ### Public constructors                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[SimpleStringSplitter](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#SimpleStringSplitter(char))`(char delimiter) ` Initializes the splitter. |

|                                                                                                                                                                                     ### Public methods                                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                                                        | ` `[hasNext](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#hasNext())`() ` Returns`true`if the iteration has more elements.                                                                        |
| ` `[Iterator](https://developer.android.com/reference/java/util/Iterator)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | ` `[iterator](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#iterator())`() ` Returns an iterator over elements of type`T`.                                                                         |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                             | ` `[next](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#next())`() ` Returns the next element in the iteration.                                                                                    |
| ` void`                                                                                                                                           | ` `[remove](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#remove())`() ` Removes from the underlying collection the last element returned by this iterator (optional operation).                   |
| ` void`                                                                                                                                           | ` `[setString](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter#setString(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` string) ` Sets the string to split |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.util.Iterator](https://developer.android.com/reference/java/util/Iterator)` ` |--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default void`                                                                | ` `[forEachRemaining](https://developer.android.com/reference/java/util/Iterator#forEachRemaining(java.util.function.Consumer<?%20super%20E>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super E> action) ` Performs the given action for each remaining element until all elements have been processed or the action throws an exception. | | ` abstract boolean`                                                            | ` `[hasNext](https://developer.android.com/reference/java/util/Iterator#hasNext())`() ` Returns`true`if the iteration has more elements.                                                                                                                                                                                                                                              | | ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[next](https://developer.android.com/reference/java/util/Iterator#next())`() ` Returns the next element in the iteration.                                                                                                                                                                                                                                                          | | ` default void`                                                                | ` `[remove](https://developer.android.com/reference/java/util/Iterator#remove())`() ` Removes from the underlying collection the last element returned by this iterator (optional operation).                                                                                                                                                                                         | ||
| From interface` `[android.text.TextUtils.StringSplitter](https://developer.android.com/reference/android/text/TextUtils.StringSplitter)` ` |------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[setString](https://developer.android.com/reference/android/text/TextUtils.StringSplitter#setString(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` string) ` | ||
| From interface` `[java.lang.Iterable](https://developer.android.com/reference/java/lang/Iterable)` ` |-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default void`                                                                                                                                                 | ` `[forEach](https://developer.android.com/reference/java/lang/Iterable#forEach(java.util.function.Consumer<?%20super%20T>))`(`[Consumer](https://developer.android.com/reference/java/util/function/Consumer)`<? super T> action) ` Performs the given action for each element of the`Iterable`until all elements have been processed or the action throws an exception. | | ` abstract `[Iterator](https://developer.android.com/reference/java/util/Iterator)`<`[String](https://developer.android.com/reference/java/lang/String)`>`      | ` `[iterator](https://developer.android.com/reference/java/lang/Iterable#iterator())`() ` Returns an iterator over elements of type`T`.                                                                                                                                                                                                                                   | | ` default `[Spliterator](https://developer.android.com/reference/java/util/Spliterator)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | ` `[spliterator](https://developer.android.com/reference/java/lang/Iterable#spliterator())`() ` Creates a[Spliterator](https://developer.android.com/reference/java/util/Spliterator)over the elements described by this`Iterable`.                                                                                                                                       | ||

## Public constructors

### SimpleStringSplitter

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public SimpleStringSplitter (char delimiter)
```

Initializes the splitter. setString may be called later.

<br />

|                         Parameters                          ||
|-------------|------------------------------------------------|
| `delimiter` | `char`: the delimiter on which to split <br /> |

## Public methods

### hasNext

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean hasNext ()
```

Returns`true`if the iteration has more elements. (In other words, returns`true`if[next()](https://developer.android.com/reference/java/util/Iterator#next())would return an element rather than throwing an exception.)

<br />

|                          Returns                           ||
|-----------|-------------------------------------------------|
| `boolean` | `true`if the iteration has more elements <br /> |

### iterator

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Iterator<String> iterator ()
```

Returns an iterator over elements of type`T`.

<br />

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|
| [Iterator](https://developer.android.com/reference/java/util/Iterator)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | an Iterator. <br /> |

### next

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String next ()
```

Returns the next element in the iteration.

<br />

|                                                   Returns                                                    ||
|--------------------------------------------------------------------|------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the next element in the iteration <br /> |

### remove

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void remove ()
```

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to[next()](https://developer.android.com/reference/java/util/Iterator#next()).

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the[forEachRemaining](https://developer.android.com/reference/java/util/Iterator#forEachRemaining(java.util.function.Consumer<?%20super%20E>))method.

<br />

### setString

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setString (String string)
```

Sets the string to split

<br />

|                   Parameters                   ||
|----------|--------------------------------------|
| `string` | `String`: the string to split <br /> |