Common ASP functions: getpy ()

Source: Internet
Author: User

<%
'Retrieve the first letter of each Chinese Character in the field data

Function getpychar (char)
Tmp = 65536 + Asc (char)
If (tmp> = 45217 And tmp <= 45252) Then
Getpychar = ""
ElseIf (tmp & gt; = 45253 And tmp <= 45760) Then
Getpychar = "B"
ElseIf (tmp & gt; = 47761 And tmp <= 46317) Then
Getpychar = "C"
ElseIf (tmp & gt; = 46318 And tmp <= 46825) Then
Getpychar = "D"
ElseIf (tmp & gt; = 46826 And tmp <= 47009) Then
Getpychar = "E"
ElseIf (tmp & gt; = 47010 And tmp <= 47296) Then
Getpychar = "F"
ElseIf (tmp & gt; = 47297 And tmp <= 47613) Then
Getpychar = "G"
ElseIf (tmp & gt; = 47614 And tmp <= 48118) Then
Getpychar = "H"
ElseIf (tmp & gt; = 48119 And tmp <= 49061) Then
Getpychar = "J"
ElseIf (tmp & gt; = 49062 And tmp <= 49323) Then
Getpychar = "K"
ElseIf (tmp & gt; = 49324 And tmp <= 49895) Then
Getpychar = "L"
ElseIf (tmp & gt; = 49896 And tmp <= 50370) Then
Getpychar = "M"
ElseIf (tmp & gt; = 50371 And tmp <= 50613) Then
Getpychar = "N"
ElseIf (tmp & gt; = 50614 And tmp <= 50621) Then
Getpychar = "O"
ElseIf (tmp & gt; = 50622 And tmp <= 50905) Then
Getpychar = "P"
ElseIf (tmp & gt; = 50906 And tmp <= 51386) Then
Getpychar = "Q"
ElseIf (tmp & gt; = 51387 And tmp <= 51445) Then
Getpychar = "R"
ElseIf (tmp & gt; = 51446 And tmp <= 52217) Then
Getpychar = "S"
ElseIf (tmp & gt; = 52218 And tmp <= 52697) Then
Getpychar = "T"
ElseIf (tmp & gt; = 52698 And tmp <= 52979) Then
Getpychar = "W"
ElseIf (tmp & gt; = 52980 And tmp <= 53640) Then
Getpychar = "X"
ElseIf (tmp & gt; = 53689 And tmp <= 54480) Then
Getpychar = "Y"
ElseIf (tmp & gt; = 54481 And tmp <= 62289) Then
Getpychar = "Z"
Else' if it is not Chinese, it will not be processed
Getpychar = char
End If
End Function

Function getpy (Str)
For I = 1 To Len (Str)
Getpy = getpy & getpychar (Mid (Str, I, 1 ))
Next
End Function
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.