Skip to content

Commit

Permalink
improvement(RemoveOrdinalSuffix): added example and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
payam-zahedi committed May 27, 2021
1 parent 53271c0 commit 57d14a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions example/example_remove_ordinal_suffix.dart
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 57d14a1

Please sign in to comment.