![]() |
VOOZH | about |
In Dart language, strings are simply a sequence of UTF-16 (16-bit Unicode Transformation Format) code units. The Unicode format maps a unique numeric character to represent every digit, letter, or symbol.
A rune can be defined as an integer used to represent any Unicode code point. As a Dart string is a simple sequence of UTF-16 code units, 32-bit Unicode values in a string are represented using a special syntax. The String class in the dart:core library gives ways to access runes. Runes can be accessed in the following ways :
This property returns an unchangeable list of the 16-bit UTF-16 code units of the given string.
Syntax:
String. codeUnits;
Example:
Output:
[71, 101, 101, 107, 115, 102, 111, 114, 71, 101, 101, 107, 115]
String.runes extend Iterable. This property returns an iterable of Unicode code-points of the specified string.
Syntax:
String.runes;
Example:
Output:
G F G
It is used to return the UTF-16 code unit at the specified index of this string.
Syntax:
String.codeUnitAt(int index);
Example:
Output:
101