xstring 1.0.0 copy "xstring: ^1.0.0" to clipboard
xstring: ^1.0.0 copied to clipboard

discontinued
outdated

String extensions to make working with String? variables more convenient. Useful for dealing with empty and nullable strings (isBlank, orElse, etc), code generation (camelCase, underscored, etc) or ge [...]

example/main.dart

import 'package:xstring/xstring.dart';

void main() {
  final name = 'foo bar';

  print('${name.titleized} (${name.initials})');
  // output: Foo Bar (FB)

  print(name.camelCase);
  // output: fooBar

  print(name.underscored);
  // output: foo_bar

  String? test = null;
  print('isBlank: ${test.isBlank}');
  // output: isBlank: true;

  test = 'null';
  print('isBlank: ${test.isBlank}');
  // output: isBlank: true;

  test = '';
  print('isBlank: ${test.isBlank}');
  // output: isBlank: true;

  test = '   ';
  print('isBlank: ${test.isBlank}');
  // output: isBlank: true;

  test = ' - ';
  print('isBlank: ${test.isBlank}');
  // output: isBlank: false;

  test = 'string 1';
  print(test.orElse('string 2'));
  // output: string 1

  test = null;
  print(test.orElse('string 2'));
  // output: string 2
}
0
likes
0
pub points
59%
popularity

Publisher

unverified uploader

String extensions to make working with String? variables more convenient. Useful for dealing with empty and nullable strings (isBlank, orElse, etc), code generation (camelCase, underscored, etc) or general output of data (titleize, initials, etc)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on xstring