cstring 1.0.0-dev copy "cstring: ^1.0.0-dev" to clipboard
cstring: ^1.0.0-dev copied to clipboard

Dart 1 only

Char support + Native bindings for a few <cstring> functions.

dart_cstring #

Native bindings for a few <cstring> functions, also includes char support.

Installation #

dependencies:
  cstring: ^1.0.0-dev

Usage #

Strings #

import "package:cstring/cstring.dart";

main() {
  var greeting = new Cstring("Hello, world!");

  // strncmp
  bool saysHi = greeting.compareN(new Cstring("Hello"), 5) == 0;

  // strcmp
  print(saysHi = "foo");

  // Also static
  print(Cstring.strncmp("A", "B", 1));
}

Chars #

import "package:cstring/cstring.dart";

class SomeLexer {
  List<Token> tokens = [];

  void scan(String text) {
    // Automatically takes first char of string
    Char ch = new Char(text);

    // isdigit, isalnum, isalpha
    if (ch.isDigit())
      tokens.add(new Token("NUMBER", ch.value));
  }
}
0
likes
15
pub points
0%
popularity

Publisher

unverified uploader

Char support + Native bindings for a few <cstring> functions.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on cstring