unicode_scripts_blocks 0.4.0
unicode_scripts_blocks: ^0.4.0 copied to clipboard

discontinued

A tool for checking if a code unit belongs to a Unicode Script or Block.

example/unicode_scripts_blocks_example.dart

import 'package:unicode_scripts_blocks/src/script.dart';
import 'package:unicode_scripts_blocks/unicode_scripts_blocks.dart';

main() {
  final thaiChar = 'ด'.codeUnitAt(0);
  final latinChar = 'a'.codeUnitAt(0);

  if (UnicodeScript.isThai(thaiChar)) {
    print('this script is Thai');
  } else {
    print('not Thai');
  }

  if (UnicodeBlock.isBasicLatin(latinChar)) {
    print('this block is Basic Latin');
  } else {
    print('not Basic Latin');
  }

  final scripts = UnicodeScript2.scripts;
  final punc = scripts.where((script) => script.category.startsWith('P'));
  for (Script p in punc) {
    print('${p.start} ${p.end} ${p.propertyValue} ${p.category}');
  }
  // String myString = ',;';
  // for (int codeUnit in myString.codeUnits) {
  //   if (isPunctuation(codeUnit)) {
  //     // do sth
  //   }
  // }
  //for (int i; i < myString.length; i++) {}
}

// bool isPunctuation(int codeUnit) {
//   final scripts = UnicodeScript2.scripts;
//   final punc = scripts.where((script) => script.category.startsWith('P'));
//   for (Script p in punc) {
//     print('${p.start} ${p.end} ${p.propertyValue} ${p.category}');
//   }
//   //UnicodeScript2.scripts.where((script) );
// }
0
likes
0
pub points
0%
popularity

Publisher

suragch.dev

A tool for checking if a code unit belongs to a Unicode Script or Block.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

More

Packages that depend on unicode_scripts_blocks