程序代碼
<%
PRivate Function PNum(ByVal number)
Dim tmp, ext
If IsNumeric( number ) = False Then
PNum = Null
Else
Select Case CInt( Right( number, 2 ) )
Case 11, 12, 13
ext = "th"
Case Else
tmp = Right( number, 1 )
Select Case CInt( tmp )
Case 1
ext = "st"
Case 2
ext = "nd"
Case 3
ext = "rd"
Case Else
ext = "th"
End Select
End Select
PNum = CStr( number & ext )
End If
End Function
%>
數字加st、nd、rd、th構成序數詞函數,比如
程序代碼
Response.Write PNum("123456789")
會返回
引用內容
123456789th
,英文站點較為常用的一個函數,如果輸入字符串則返回Null。