utf_ext 0.3.3 copy "utf_ext: ^0.3.3" to clipboard
utf_ext: ^0.3.3 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;
}
0
likes
160
pub points
58%
popularity

Publisher

verified publisheraiurovet.com

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

Documentation

API reference

License

MIT (LICENSE)

Dependencies

async, file, loop_visitor

More

Packages that depend on utf_ext