I think that such things should not really belong in Kernel. Is there another suitable package that can provide this as an extension method?
Also note that this is not internationalized yet (English only), but judging by the selectors it might well be used to produce localized output in the future. Maybe that could influence the selection of a package.
Am Fr., 25. Sept. 2020 um 18:32 Uhr schrieb commits@source.squeak.org:
A new version of Kernel was added to project The Inbox: http://source.squeak.org/inbox/Kernel-ct.1342.mcz
==================== Summary ====================
Name: Kernel-ct.1342 Author: ct Time: 25 September 2020, 6:32:44.665274 pm UUID: 037ef8ee-228f-914b-8d1e-b05cac84772b Ancestors: Kernel-eem.1341
Add ordinal suffix logic to Integer
Example: (1 to: 30) collect: [:ea | ea withOrdinalSuffix]
=============== Diff against Kernel-eem.1341 ===============
Item was added:
- ----- Method: Integer>>ordinalSuffix (in category 'printing') -----
- ordinalSuffix
"Answer a string containing the ordinal suffix of the receiver, e.g. 'th' for 4, or 'rd' for 23."
self \\ 100 // 10 = 1 ifFalse: [
self \\ 10
caseOf: {
[1] -> [^ 'st'].
[2] -> [^ 'nd'].
[3] -> [^ 'rd'] }
otherwise: []].
^ 'th'!
Item was added:
- ----- Method: Integer>>printWithOrdinalSuffixOn: (in category 'printing') -----
- printWithOrdinalSuffixOn: aStream
aStream
print: self;
nextPutAll: self ordinalSuffix.!
Item was added:
- ----- Method: Integer>>withOrdinalSuffix (in category 'printing') -----
- withOrdinalSuffix
^ String streamContents: [:stream |
self printWithOrdinalSuffixOn: stream]!