The syntax of String.runes property is:
Runes runes
This runes property of String returns An Iterable
of Unicode code-points of this string.
String.runes returns value of type Runes
.
In this example,
str
with the value 'Hello'.runes
property of the string.Iterable
of Unicode code-points of the string.void main() {
String str = 'Hello';
Iterable<int> strRunes = str.runes;
print('Runes of $str: $strRunes');
}
Runes of Hello: (72, 101, 108, 108, 111)
In this example,
str
with the value 'ABCDEF'.runes
property of the string.Iterable
of Unicode code-points of the string.void main() {
String str = 'ABCDEF';
Iterable<int> strRunes = str.runes;
print('Runes of $str: $strRunes');
}
Runes of ABCDEF: (65, 66, 67, 68, 69, 70)
In this example,
str
with the value 'Lorem ipsum'.runes
property of the string.Iterable
of Unicode code-points of the string.void main() {
String str = 'Lorem ipsum';
Iterable<int> strRunes = str.runes;
print('Runes of $str: $strRunes');
}
Runes of Lorem ipsum: (76, 111, 114, 101, 109, 32, 105, 112, 115, 117, 109)
In this Dart tutorial, we learned about runes property of String: the syntax and few working examples with output and detailed explanation for each example.