commons_lang 0.0.6 copy "commons_lang: ^0.0.6" to clipboard
commons_lang: ^0.0.6 copied to clipboard

Commons Lang provides a host of helper utilities for Dart / Flutter applications.

example/commons_lang_example.dart

import 'package:commons_lang/commons_lang.dart';

void main() {
  Map map = {"animal": "quick brown fox", "target": "lazy dog"};
  StrSubstitutor sub = StrSubstitutor.fromMap(map);

  // The quick brown fox jumps over the lazy dog.
  print(sub.replace('The \${animal} jumps over the \${target}.'));

  // The ${person} jumps over the lazy dog.
  print(sub.replace('The \${person} jumps over the \${target}.'));

  // Use \$ as an escape character
  // The ${animal} jumps over the lazy dog.
  print(sub.replace('The \$\${animal} jumps over the \${target}.'));

  // Variable substitution still occurs in escaped variables
  // The ${quick brown fox} jumps over the lazy dog.
  print(sub.replace('The \$\${\${animal}} jumps over the \${target}.'));

  sub.setVariablePrefix('#[');
  sub.setVariableSuffix(']');
  sub.escapeChar = '@';

  // The quick brown fox jumps over the lazy dog.
  print(sub.replace('The #[animal] jumps over the #[target].'));

  // Use @ as an escape character
  // The #[animal] jumps over the lazy dog.
  print(sub.replace('The @#[animal] jumps over the #[target].'));
}
1
likes
0
pub points
4%
popularity

Publisher

verified publisherlimeslice.org

Commons Lang provides a host of helper utilities for Dart / Flutter applications.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on commons_lang