characters 0.4.0 copy "characters: ^0.4.0" to clipboard
characters: ^0.4.0 copied to clipboard

outdated

String replacement with operations that are Unicode/grapheme cluster aware.

example/main.dart

import 'package:characters/characters.dart';

// Small API examples. For full API docs see:
// https://pub.dev/documentation/characters/latest/characters/characters-library.html
main() {
  String hi = 'Hi πŸ‡©πŸ‡°';
  print('String is "$hi"\n');

  // Length.
  print('String.length: ${hi.length}');
  print('Characters.length: ${hi.characters.length}\n');

  // Last character.
  print('The string ends with: ${hi.substring(hi.length - 1)}');
  print('The last character: ${hi.characters.last}\n');

  // Skip last character.
  print('Substring -1: "${hi.substring(0, hi.length - 1)}"');
  print('Skipping last character: "${hi.characters.skipLast(1)}"\n');

  // Replace characters.
  Characters newHi =
      Characters(hi).replaceAll(Characters('πŸ‡©πŸ‡°'), Characters('πŸ‡ΊπŸ‡Έ'));
  print('Change flag: "$newHi"');
}
420
likes
0
pub points
98%
popularity

Publisher

verified publisherdart.dev

String replacement with operations that are Unicode/grapheme cluster aware.

Homepage

License

unknown (license)

More

Packages that depend on characters