-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement(WordsToNumber): added example and README.md
- Loading branch information
1 parent
2c40641
commit d967c71
Showing
8 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:persian_tools/persian_tools.dart'; | ||
|
||
void main() { | ||
final words = 'سه هزار دویست و دوازده'; | ||
|
||
/// use [wordsToNumber] method to convert [words] to int number | ||
print(wordsToNumber(words)); // 3212 | ||
|
||
/// use [wordsToNumberString] method to convert [words] to String | ||
print(wordsToNumberString(words)); // '3212' as String | ||
|
||
/// [wordsToNumberString] also has two optional parameter | ||
/// use [digit] optional parameter to convert the digits to specific local digits | ||
/// use [addComma] to add comma between the every 3 digits | ||
print(wordsToNumberString( | ||
words, | ||
digits: DigitLocale.fa, | ||
addComma: true, | ||
)); // '۳,۲۱۲' as String | ||
|
||
/// or you can easily use extension methods on String object | ||
print(words.convertWordsToNumber()); // 3212 | ||
|
||
print(words.convertWordsToNumberString()); // '3212' as String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ class Plate { | |
|
||
extension VehiclePlate on String { | ||
Plate get createVehiclePlate => Plate(plate: this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters