Stay organized with collections
Save and categorize content based on your preferences.
SimpleStringSplitter
open class SimpleStringSplitter : MutableIterator<String!>, TextUtils.StringSplitter
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 |
Initializes the splitter.
|
Public constructors
SimpleStringSplitter
SimpleStringSplitter(delimiter: Char)
Initializes the splitter. setString may be called later.
Parameters |
delimiter |
Char: the delimeter on which to split |
Public methods
hasNext
open fun hasNext(): Boolean
Return |
Boolean |
true if the iteration has more elements |
next
open fun next(): String!
Return |
String! |
the next element in the iteration |
Exceptions |
java.util.NoSuchElementException |
if the iteration has no more elements |
remove
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
open fun setString(string: String!): Unit
Sets the string to split
Parameters |
string |
String!: the string to split |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# TextUtils.SimpleStringSplitter\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSimpleStringSplitter\n====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/TextUtils.SimpleStringSplitter \"View this page in Java\") \n\n```\nopen class SimpleStringSplitter : MutableIterator\u003cString!\u003e, TextUtils.StringSplitter\n```\n\n|---|--------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.text.TextUtils.SimpleStringSplitter](#) |\n\nA simple string splitter.\n\nIf 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\", \"\".\n\nSummary\n-------\n\n| Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [SimpleStringSplitter](#SimpleStringSplitter(kotlin.Char))`(`delimiter:` `[Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html)`)` Initializes the splitter. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [hasNext](#hasNext())`()` \u003cbr /\u003e |\n| open [MutableIterator](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-iterator/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e | [iterator](#iterator())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [next](#next())`()` \u003cbr /\u003e |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [remove](#remove())`()` \u003cbr /\u003e |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setString](#setString(kotlin.String))`(`string:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the string to split |\n\nPublic constructors\n-------------------\n\n### SimpleStringSplitter\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nSimpleStringSplitter(delimiter: Char)\n```\n\nInitializes the splitter. setString may be called later.\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------|\n| `delimiter` | [Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html): the delimeter on which to split |\n\nPublic methods\n--------------\n\n### hasNext\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun hasNext(): Boolean\n```\n\n| Return ||\n|------------------------------------------------------------------------------------|-------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if the iteration has more elements |\n\n### iterator\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun iterator(): MutableIterator\u003cString!\u003e\n```\n\n| Return ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|\n| [MutableIterator](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-iterator/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e | an Iterator. |\n\n### next\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun next(): String!\n```\n\n| Return ||\n|-----------------------------------------------------------------------------------|-----------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the next element in the iteration |\n\n| Exceptions ||\n|------------------------------------|---------------------------------------|\n| `java.util.NoSuchElementException` | if the iteration has no more elements |\n\n### remove\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun remove(): Unit\n```\n\n| Exceptions ||\n|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| `java.lang.UnsupportedOperationException` | if the `remove` operation is not supported by this iterator |\n| `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 |\n\n### setString\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun setString(string: String!): Unit\n```\n\nSets the string to split\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------|\n| `string` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the string to split |"]]