Skip to Content
Dart: Scalable Application Development
book

Dart: Scalable Application Development

by Davy Mitchell, Sergey Akopkokhyants, Ivo Balbaert
June 2017
Intermediate to advanced
873 pages
18h 9m
English
Packt Publishing
Content preview from Dart: Scalable Application Development

Strings and Unicode

Dart Strings are immutable sequences of UTF-16 code units. UTF-16 combines surrogate pairs, and if you decode these, you get Unicode code points. Unicode terminology is terse, but Dart does a good job of exposing the different parts.

How to do it...

We will see the different methods to perform action on strings with special characters in unicode.dart:

String country = "Egypt";
String city = "Zürich";
String japanese = "日本語"; // nihongo meaning 'Japanese'

void main() {
  print('Unicode escapes: \uFE18'); //  the ⎕ symbol
  print(country[0]);                 // E
  print(country.codeUnitAt(0));      // 69
  print(country.codeUnits);          // [69, 103, 121, 112, 116]
  print(country.runes.toList());     // [69, 103, 121, 112, 116]
 print(new String.fromCharCode(69)); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

You might also like

Dart in Action

Dart in Action

Chris Buckett
Dart: Up and Running

Dart: Up and Running

Kathy Walrath, Seth Ladd

Publisher Resources

ISBN: 9781787288027