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.
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)); // E print(new String.fromCharCodes([69, 103, 121, 112, 116])); // Egypt print(city[1]); // ü print(city.codeUnitAt(1)); // 252 print(city.codeUnits); // [90, 252, 114...