Dart Runes length
Syntax & Examples
Runes.length property
The `length` property in Dart returns the number of elements in the sequence of Unicode code points.
Syntax of Runes.length
The syntax of Runes.length property is:
int length
This length property of Runes returns the number of elements in this
.
Return Type
Runes.length returns value of type int
.
✐ Examples
1 Get length of sequence
In this example,
- We create a sequence of Unicode code points
runes
from the string 'Hello'. - We use the
length
property to get its length. - We then print the result to standard output.
Dart Program
void main() {
Runes runes = Runes('Hello');
int length = runes.length;
print('Length of sequence: $length');
}
Output
Length of sequence: 5
2 Get length of sequence of emojis
In this example,
- We create a sequence of Unicode code points
emojis
from the string '🚀🌟'. - We use the
length
property to get its length. - We then print the result to standard output.
Dart Program
void main() {
Runes emojis = Runes('🚀🌟');
int emojiLength = emojis.length;
print('Length of emoji sequence: $emojiLength');
}
Output
Length of emoji sequence: 2
Summary
In this Dart tutorial, we learned about length property of Runes: the syntax and few working examples with output and detailed explanation for each example.