utf_ext 0.2.2 copy "utf_ext: ^0.2.2" to clipboard
utf_ext: ^0.2.2 copied to clipboard

A library for reading and writing text files in any major Unicode format (UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE)

example/example.md

How To Use the utf_ext Package

Contents #

  • utf_cat.dart - see how to read UTF files and print to terminal, similar to cat (POSIX) or type (Windows)
  • utf_conv.dart - see how to convert files from one UTF format to another, similar to iconv (POSIX)

Sample code #

/// This example depends on the package 'loop_visitor'

import 'package:file/file.dart';
import 'package:loop_visitor/loop_visitor.dart';
...
final data = await filterByPrefixAndToUpperCase('example.md', '-');
...
Future<List<String>> filterByPrefixAndToUpperCase(FileSystem fs, String filePath, String prefix) async {
  final pileup = <String>[];

  await fs.file(filePath).readUtfAsLines(pileup: pileup, onRead: (param) {
    final line = param.current!;

    if (!line.startsWith(prefix)) {
      return VisitResult.skip;
    }

    param.current = line.toUpperCase();

    return VisitResult.take;
  });

  return pileup;
}
1
likes
0
points
60
downloads

Publisher

verified publisheraiurovet.com

Weekly Downloads

A library for reading and writing text files in any major Unicode format (UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE)

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

async, file, loop_visitor

More

Packages that depend on utf_ext