diff --git a/README.md b/README.md index 0e6473c..2dbefcb 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ ## Features +- [x] [Removing ordinal suffixes](#removing-ordinal-suffixes---source) - [x] [Adding ordinal suffixes](#adding-ordinal-suffixes---source) - [ ] Converting Persian words to number - [ ] Converting Persian numbers to word @@ -35,14 +36,26 @@ now let's look at examples and how work with apis in package -- #### Adding Ordinal Suffixes - [source](https://github.com/persian-tools/dart-persian-tools/blob/master/lib/src/core/add_ordinal_suffix/add_ordinal_suffix.dart) +- #### Adding Ordinal Suffixes - [source](https://github.com/persian-tools/dart-persian-tools/blob/master/lib/src/core/remove_ordinal_suffix/remove_ordinal_suffix.dart) ```dart var number = 'سی سه'; // or سی | شصت | پنجاه دو addOrdinalSuffix(number); // سی سوم | سی اُم | شصتم | پنجاه دوم + +/// or use it as String extension method number.withOrdinalSuffix // ... like so ``` +- #### Removing Ordinal Suffixes - [source](https://github.com/persian-tools/dart-persian-tools/blob/master/lib/src/core/add_ordinal_suffix/add_ordinal_suffix.dart) + +```dart +var number = 'چهل و سوم'; // سی سوم | سی اُم | شصتم | پنجاه دوم +removeOrdinalSuffix(number); // سی | شصت | پنجاه دو + +/// or use it as String extension method +number.withoutOrdinalSuffix; // ... like so +``` + - #### Adding and removing separator to / from numbers - [source](https://github.com/persian-tools/dart-persian-tools/blob/master/lib/src/core/commas/methods.dart) ```dart diff --git a/example/example_remove_ordinal_suffix.dart b/example/example_remove_ordinal_suffix.dart new file mode 100644 index 0000000..7e94436 --- /dev/null +++ b/example/example_remove_ordinal_suffix.dart @@ -0,0 +1,9 @@ +import 'package:persian_tools/persian_tools.dart'; + +void main() { + var number = 'چهل و سوم'; // سی سوم | سی اُم | شصتم | پنجاه دوم + print(removeOrdinalSuffix(number)); // سی | شصت | پنجاه دو + + /// or use it as String extension method + print(number.withoutOrdinalSuffix); // ... like so +}