[Newbies] 23 to 23rd?

Cédrick Béler cdrick65 at gmail.com
Thu Dec 11 18:53:34 UTC 2008


oups too quick... doesn't work ;)

2008/12/11 Cédrick Béler <cdrick65 at gmail.com>:
> Hi,
>
> I haven't found existing code. So I'll do that: in Integer
>
> Integer>>englishEndString
>        (self rem: 1) isZero ifTrue: [^'st'].
>        (self rem: 2) isZero ifTrue: [^'nd'].
>        (self rem: 3) isZero ifTrue: [^'rd'].
>        ^'th'
>
> Integer>>asEnglishString
>
>        self asString , self englishEndString
>
> hth,
>
> 2008/12/11 Tim Johnson <tjohnson at iwu.edu>:
>> Hi,
>>
>> Does anyone have, or know of, existing code to perform the rather
>> anglo-centric (?) function of turning 3 into '3rd,' 22 into '22nd,' etc.?
>>
>> Thanks,
>> TimJ
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
>
>
> --
> Cédrick
>



-- 
Cédrick


More information about the Beginners mailing list