File Exchange

image thumbnail

Number to Ordinal String Converter

version 1.0.0.0 (546 Bytes) by Bill Higley
Converts an integer into its ordinal string.

1 Download

Updated 09 Jul 2002

No License

This function turns a number into an ordinal string, ie 1 becomes 'first', 2 becomes 'second'. After 'twentieth', the number is used with the appropriate 'st, 'nd', 'rd', or 'th'. Useful for instructionary dialog boxes, etc.

Cite As

Bill Higley (2020). Number to Ordinal String Converter (https://www.mathworks.com/matlabcentral/fileexchange/1930-number-to-ordinal-string-converter), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Of limited use because of several spelling mistakes ('eigth', 'twelvth') and a buggy algorithm:

>> num2ordstr(111)
ans = 111st
>> num2ordstr(112)
ans = 112nd
>> num2ordstr(113)
ans = 113rd

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: ORDNUMSTR, Numeric to Ordinal-String