Skip to content

Commit 25b7986

Browse files
author
Christiaan baes
committed
updated readme for wordtonumbers and toquantity because for some reason that got lost in the previous PR.
1 parent f8549ec commit 25b7986

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ Gives the plural of a certain word.
205205

206206
```kotlin
207207
"test".pluralize() => "tests"
208+
209+
"test".pluralize(Plurality.CouldBeEither) => "tests"
210+
"tests".pluralize(Plurality.CouldBeEither) => "tests"
208211
```
209212

210213
### Extension method singularize for String objects
@@ -213,4 +216,46 @@ gives the singular of a certain word.
213216

214217
```kotlin
215218
"tests".singularize() => "test"
219+
220+
"test".singularize(Plurality.CouldBeEither) => "test"
221+
"tests".singularize(Plurality.CouldBeEither) => "test"
222+
```
223+
224+
## <a id="numbertowords">Number to words</a>
225+
226+
### Extension method toWords for String objects
227+
228+
Gives the value in words.
229+
230+
```kotlin
231+
1.toWords() => "one"
232+
10.toWords() => "ten"
233+
```
234+
235+
### Extension method toOrdinalWords for String objects
236+
237+
Gives the value in ordinal words.
238+
239+
```kotlin
240+
1.toOrdinalWords() => "first"
241+
10.toOrdinalWords() => "tenth"
242+
```
243+
244+
## <a id="toquantity">To quantity</a>
245+
246+
### Extension method toQuantity for String objects
247+
248+
```kotlin
249+
"case".toQuantity(1) => "1 case"
250+
"cases".toQuantity(1) => "1 case"
251+
"case".toQuantity(10) => "10 cases"
252+
253+
"cases".toQuantity(1, showAsQuantity = ShowQuantityAs.None) => "case"
254+
"cases".toQuantity(2, showAsQuantity = ShowQuantityAs.None) => "cases"
255+
256+
"cases".toQuantity(1, showAsQuantity = ShowQuantityAs.Numeric) => "1 case"
257+
"cases".toQuantity(2, showAsQuantity = ShowQuantityAs.Numeric) => "1 case"
258+
259+
"cases".toQuantity(1, showAsQuantity = ShowQuantityAs.Words) => "one case"
260+
"cases".toQuantity(2, showAsQuantity = ShowQuantityAs.Words) => "two cases"
216261
```

0 commit comments

Comments
 (0)