# TextUtils.SimpleStringSplitter

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

# SimpleStringSplitter

*** ** * ** ***

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

```
open class SimpleStringSplitter : MutableIterator<String!>, TextUtils.StringSplitter
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                             ||
| ↳ | [android.text.TextUtils.SimpleStringSplitter](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter#) |

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/kotlin/android/text/TextUtils.SimpleStringSplitter#SimpleStringSplitter(kotlin.Char))`(`delimiter:` `[Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html)`)` Initializes the splitter. |

|                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                   | [hasNext](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter#hasNext())`()` <br />                                                                                                                                 |
| open[MutableIterator](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-iterator/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\> | [iterator](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter#iterator())`()` <br />                                                                                                                               |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                                                                                                                    | [next](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter#next())`()` <br />                                                                                                                                       |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                         | [remove](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter#remove())`()` <br />                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                         | [setString](https://developer.android.com/reference/kotlin/android/text/TextUtils.SimpleStringSplitter#setString(kotlin.String))`(`string:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the string to split |

## Public constructors

### SimpleStringSplitter

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

```
SimpleStringSplitter(delimiter: Char)
```

Initializes the splitter. setString may be called later.

|                                                        Parameters                                                         ||
|-------------|--------------------------------------------------------------------------------------------------------------|
| `delimiter` | [Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html):the delimiter on which to split |

## Public methods

### hasNext

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

```
open fun hasNext(): Boolean
```

|                                                            Return                                                            ||
|------------------------------------------------------------------------------------|------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if the iteration has more elements |

### iterator

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

```
open fun iterator(): MutableIterator<String!>
```

|                                                                                                      Return                                                                                                      ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
| [MutableIterator](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-iterator/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!> | an Iterator. |

### next

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

```
open fun next(): String!
```

|                                                        Return                                                        ||
|-----------------------------------------------------------------------------------|-----------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the next element in the iteration |

|                                Exceptions                                 ||
|------------------------------------|---------------------------------------|
| `java.util.NoSuchElementException` | if the iteration has no more elements |

### remove

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

```
open fun remove(): Unit
```

|                                                                                 Exceptions                                                                                 ||
|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.UnsupportedOperationException` | if the`remove`operation is not supported by this iterator                                                                       |
| `java.lang.IllegalStateException`         | if the`next`method has not yet been called, or the`remove`method has already been called after the last call to the`next`method |

### setString

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

```
open fun setString(string: String!): Unit
```

Sets the string to split

|                                                   Parameters                                                    ||
|----------|-------------------------------------------------------------------------------------------------------|
| `string` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the string to split |