The string property codeunits in Dart programming language returned the list of UTF-16 code of the characters of a string. It is very useful string properties to directly find UTF-16 code units.
Syntax: String.codeUnits
Returns: a list of UTF-16 code units
Example 1:
Dart
// main function start void main() { // initialize string st String st = "Geeksforgeeks"; // print the UTF-16 code print(st.codeUnits); } |
chevron_right
filter_none
Output:
[71, 101, 101, 107, 115, 102, 111, 114, 103, 101, 101, 107, 115]
Example 2:
Dart
// main function start void main() { // initialize string st String st = "Computer"; // print the UTF-16 code print(st.codeUnits); } |
chevron_right
filter_none
Output:
[67, 111, 109, 112, 117, 116, 101, 114]
Recommended Posts:
- Dart - Splitting of String
- 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 - 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 contribute@geeksforgeeks.org. 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.

