Dart Runes toString()
Syntax & Examples

Runes.toString() method

The `toString` method in Dart returns a string representation of some or all of the elements of the Rune sequence.


Syntax of Runes.toString()

The syntax of Runes.toString() method is:

 String toString() 

This toString() method of Runes returns a string representation of (some of) the elements of this.

Return Type

Runes.toString() returns value of type String.



✐ Examples

1 String representation of runes

In this example,

  1. We create a sequence of Unicode code points runes from the string 'Hello'.
  2. We call the toString method to get the string representation of the runes.
  3. We then print the string representation to standard output.

Dart Program

void main() {
  Runes runes = Runes('Hello');
  String runesString = runes.toString();
  print('String representation of runes: $runesString');
}

Output

String representation of runes: (72, 101, 108, 108, 111)

2 String representation of numbers

In this example,

  1. We create a sequence of Unicode code points numbers from the string '12345'.
  2. We call the toString method to get the string representation of the numbers.
  3. We then print the string representation to standard output.

Dart Program

void main() {
  Runes numbers = Runes('12345');
  String numbersString = numbers.toString();
  print('String representation of numbers: $numbersString');
}

Output

String representation of numbers: (49, 50, 51, 52, 53)

Summary

In this Dart tutorial, we learned about toString() method of Runes: the syntax and few working examples with output and detailed explanation for each example.