From 57d14a113d72de1af14291d0387c5c747c1ddf17 Mon Sep 17 00:00:00 2001 From: Payam Zahedi Date: Fri, 28 May 2021 00:25:30 +0430 Subject: [PATCH] improvement(RemoveOrdinalSuffix): added example and README.md --- README.md | 15 ++++++++++++++- example/example_remove_ordinal_suffix.dart | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 example/example_remove_ordinal_suffix.dart 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 +}