string_dogoo 0.1.0 copy "string_dogoo: ^0.1.0" to clipboard
string_dogoo: ^0.1.0 copied to clipboard

Provides simple functions and extensions for string type. This is part of the 'dogoo' package that provides 'Dart' and 'Flutter' utilities.

This is part of the dogoo package that provides Dart and Flutter utilities.

String Dogoo provides utility functions and extension for String.

Features #

  • Returns nullable boolean value from string value
  • Make string value to Titlecase.

Usage #

import 'package:string_dogoo/string_dogoo.dart';

void main() {
  print("${stringToBool("true")}, ${stringToBool("true").runtimeType}"); // true, bool
  print("${stringToBool("True")}, ${stringToBool("True").runtimeType}"); // true, bool
  print("${stringToBool("truE")}, ${stringToBool("truE").runtimeType}"); // true, bool

  print("${stringToBool("false")}, ${stringToBool("false").runtimeType}"); // false, bool
  print("${stringToBool("False")}, ${stringToBool("False").runtimeType}"); // false, bool
  print("${stringToBool("falsE")}, ${stringToBool("falsE").runtimeType}"); // false, bool

  print(stringToBool("abcdef")); // null
  print(stringToBool("")); // null

  print(stringToTitleCase("apple")); // Apple
  print(stringToTitleCase("banana")); // Banana

  // * -------------------- *

  print("${"true".toBool()}, ${"true".toBool().runtimeType}"); // true, bool
  print("${"True".toBool()}, ${"True".toBool().runtimeType}"); // true, bool
  print("${"truE".toBool()}, ${"truE".toBool().runtimeType}"); // true, bool

  print("${"false".toBool()}, ${"false".toBool().runtimeType}"); // false, bool
  print("${"False".toBool()}, ${"False".toBool().runtimeType}"); // false, bool
  print("${"falsE".toBool()}, ${"falsE".toBool().runtimeType}"); // false, bool

  print("abcdef".toBool()); // null
  print("".toBool()); // null

  print("apple".toTitleCase()); // Apple
  print("banana".toTitleCase()); // Banana
}
1
likes
160
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

Provides simple functions and extensions for string type. This is part of the 'dogoo' package that provides 'Dart' and 'Flutter' utilities.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on string_dogoo