platform/packages/inflection3/example/main.dart

25 lines
973 B
Dart
Raw Normal View History

2021-05-17 15:10:07 +00:00
import 'package:inflection3/inflection3.dart';
2021-05-02 08:39:25 +00:00
2021-05-17 14:50:37 +00:00
void main() {
2021-05-02 08:39:25 +00:00
// Using 'shortcut' functions.
2021-05-17 15:10:07 +00:00
print(pluralize('house')); // => 'houses'
print(convertToPlural('house')); // => 'houses', alias for pluralize
print(pluralizeVerb('goes')); // => 'go'
print(singularize('axes')); // => 'axis'
print(convertToSingular('axes')); // => 'axis', alias for pluralize
print(singularizeVerb('write')); // => 'writes'
print(convertToSnakeCase('CamelCaseName')); // => 'camel_case_name'
print(convertToSpinalCase('CamelCaseName')); // => 'camel-case-name'
print(past('forgo')); // => 'forwent'
2021-05-02 08:39:25 +00:00
// Using default encoders.
2021-05-17 15:10:07 +00:00
print(PLURAL.convert('virus')); // => 'viri'
print(SINGULAR.convert('Matrices')); // => 'Matrix'
print(SINGULAR.convert('species')); // => 'species'
print(SNAKE_CASE.convert('CamelCaseName')); // => 'camel_case_name'
print(SPINAL_CASE.convert('CamelCaseName')); // => 'camel-case-name'
print(PAST.convert('miss')); // => 'missed'
2021-05-02 08:39:25 +00:00
}