WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Numbers

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UDF - Number to Adjective Acronym

Keywords: 	 UDF - Number to Adjective Acronym

; UDF to convert number to adjective acronym
; eg  3 to 3rd    111 to 111th    82 to 82nd

#DefineFunction stndth(number)
   tens=number mod 100
   ;three special cases
   if  tens==11 || tens==12 || tens==13  
   	number=strcat(number,"th")
   else
      units=number mod 10
   	select units
   		case 1
   			number=strcat(number,"st")
   			break
   		case 2
   			number=strcat(number,"nd")
   			break
   		case 3
   			number=strcat(number,"rd")
   			break
   		case units
   			number=strcat(number,"th")
   			break
   	end select
   endif
   return(number)
#EndFunction




Article ID:   W15759
File Created: 2003:05:13:11:29:56
Last Updated: 2003:05:13:11:29:56