·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP网站建设 >> ASP数字加词缀转成英文序数词

ASP数字加词缀转成英文序数词

作者:佚名      ASP网站建设编辑:admin      更新时间:2022-07-23

程序代码
<%
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。