Lasso Soft Inc. > Home

[integer-asStringOrd]

Linkinteger-asStringOrd
AuthorBrad Lindsay
CategoryNamespace
Version9.x
LicensePublic Domain
Posted27 Dec 2011
Updated28 Dec 2011
More by this author...

Description

The [integer->asStringOrd] returns the ordinal format of an integer.

Sample Usage

1->asStringOrd

// Returns '1st'

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define integer->asStringOrd => {
    (:11,12,13)->contains(self % 100)?
        return self->asString + 'th'

    return self->asString + (:'th','st','nd','rd','th','th','th','th','th','th')->get((self % 10) + 1)
}

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft