In Dart splitting of a string can be done with the help split string function in the dart. It is a built-in function use to split the string into substring across a common character.
This function splits the string into substring across the given pattern and then store them to a list.
Example 1: Splitting a string across space.
[Geeks, For, Geeks, !!]
Example 2: Splitting each character of the string.
[G, e, e, k, s, F, o, r, G, e, e, k, s]
Apart from the above pattern, the pattern can also be a regex. It is useful when we have to split across a group of characters like numbers, special characters, etc.
Example 3: Splitting a string across any number present in it. (Using regex)
[Geeks, For, Geeks, is, the, best, computer, science, website.]
- How to Find the Length of a String in Dart?
- How to Replace a Substring of a String in Dart?
- How to Check String is Empty or not in Dart?
- Dart - String codeUnits Property
- Dart - Convert All Characters of a String in Lowercase
- Dart - String toUpperCase() Function with Examples
- How to Combine Lists in Dart?
- Basics of Numbers in Dart
- Dart - Super and This keyword
- Dart - Standard Input Output
- Generators in Dart
- Dart - Classes And Objects
- Operators in Dart
- Dart - Loops
- Switch Case in Dart
- Dart - Loop Control Statements (Break and Continue)
- Dart Programming - Functions
- Instance and class methods in Dart
- Abstract Classes in Dart
- Labels in Dart
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.