# TextUtils.StringSplitter

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

# TextUtils.StringSplitter

*** ** * ** ***

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

`
public
static


interface
TextUtils.StringSplitter
`  
`


implements

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


`

|---------------------------------------|
| android.text.TextUtils.StringSplitter |

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [TextUtils.SimpleStringSplitter](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter) |-----------------------------------------------------------------------------------------------------------------------|---------------------------| | [TextUtils.SimpleStringSplitter](https://developer.android.com/reference/android/text/TextUtils.SimpleStringSplitter) | A simple string splitter. | |

<br />

*** ** * ** ***

An interface for splitting strings according to rules that are opaque to the user of this interface. This also has less overhead than split, which uses regular expressions and allocates an array to hold the results.

The most efficient way to use this class is:  

```
 // Once
 TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(delimiter);

 // Once per string to split
 splitter.setString(string);
 for (String s : splitter) {
     ...
 }
 
```

<br />

## Summary

|                                                                                                     ### Public methods                                                                                                      ||
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` 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) ` |

| ### Inherited methods |
|-----------------------|---|
| 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 methods

### setString

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

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

<br />

<br />

|        Parameters         ||
|----------|-----------------|
| `string` | `String` <br /> |