注册 | 登录 | 设为首页 | 加入收藏
您当前的位置:飞翔学院-IT中国 → 编程开发Asp → 文章内容

读取字符串的第一个字母

作者:佚名 来源:本站整理 发布时间:2007-10-30 22:33:19
    '作  用:读取字符串的第一个字母
    '参  数:str   ----字符
    '返回值:返回第一个字母
    '================================================
    Public Function ReadAlpha() Function ReadAlpha(ByVal str)
  Dim strTemp
  If IsNull(str) Or Trim(str) = "" Then
      ReadAlpha = "A-9"
      Exit Function
  End If
  str = Trim(str)
  strTemp = 65536 + Asc(str)
  If (strTemp >= 45217 And strTemp <= 45252) Or (strTemp = 65601) Or (strTemp = 65633) Or (strTemp = 37083) Then
      ReadAlpha = "A-Z"
  ElseIf (strTemp >= 45253 And strTemp <= 45760) Or (strTemp = 65602) Or (strTemp = 65634) Or (strTemp = 39658) Then
      ReadAlpha = "B-Z"
  ElseIf (strTemp >= 45761 And strTemp <= 46317) Or (strTemp = 65603) Or (strTemp = 65635) Or (strTemp = 33405) Then
      ReadAlpha = "C-Z"
  ElseIf (strTemp >= 46318 And strTemp <= 46836) Or (strTemp >= 46847 And strTemp <= 46930) Or (strTemp >= 61884 And strTemp <= 61884) Or (strTemp = 65604) Or (strTemp >= 36820 And strTemp <= 38524) Or (strTemp = 65636) Then
      ReadAlpha = "D-Z"
  ElseIf (strTemp >= 46837 And strTemp <= 46846) Or (strTemp >= 46931 And strTemp <= 47009) Or (strTemp = 65605) Or (strTemp = 65637) Or (strTemp = 61513) Then
      ReadAlpha = "E-Z"
  ElseIf (strTemp >= 47010 And strTemp <= 47296) Or (strTemp = 65606) Or (strTemp = 65638) Or (strTemp = 61320) Or (strTemp = 63568) Or (strTemp = 36281) Then
      ReadAlpha = "F-Z"
  ElseIf (strTemp >= 47297 And strTemp <= 47613) Or (strTemp = 65607) Or (strTemp = 65639) Or (strTemp = 35949) Or (strTemp = 36089) Or (strTemp = 36694) Or (strTemp = 34808) Then
      ReadAlpha = "G-Z"
  ElseIf (strTemp >= 47614 And strTemp <= 48118) Or (strTemp >= 59112 And strTemp <= 59112) Or (strTemp = 65608) Or (strTemp = 65640) Then
      ReadAlpha = "H-Z"
  ElseIf (strTemp = 65641) Or (strTemp = 65609) Or (strTemp = 65641) Then
      ReadAlpha = "I-Z"
  ElseIf (strTemp >= 48119 And strTemp <= 49061 And strTemp <> 48739) Or (strTemp >= 62430 And strTemp <= 62430) Or (strTemp = 65610) Or (strTemp = 65642) Or (strTemp = 39048) Then
      ReadAlpha = "J-Z"
  ElseIf (strTemp >= 49062 And strTemp <= 49323) Or (strTemp = 65611) Or (strTemp = 65643) Then
      ReadAlpha = "K-Z"
  ElseIf (strTemp >= 49324 And strTemp <= 49895) Or (strTemp >= 58838 And strTemp <= 58838) Or (strTemp = 65612) Or (strTemp = 65644) Or (strTemp = 62418) Or (strTemp = 48739) Then
      ReadAlpha = "L-Z"
  ElseIf (strTemp >= 49896 And strTemp <= 50370) Or (strTemp = 65613) Or (strTemp = 65645) Then
      ReadAlpha = "M-Z"
  ElseIf (strTemp >= 50371 And strTemp <= 50613) Or (strTemp = 65614) Or (strTemp = 65646) Then
      ReadAlpha = "N-Z"
  ElseIf (strTemp >= 50614 And strTemp <= 50621) Or (strTemp = 65615) Or (strTemp = 65647) Then
      ReadAlpha = "O-Z"
  ElseIf (strTemp >= 50622 And strTemp <= 50905) Or (strTemp = 65616) Or (strTemp = 65648) Then
      ReadAlpha = "P-Z"
  ElseIf (strTemp >= 50906 And strTemp <= 51386) Or (strTemp >= 62659 And strTemp <= 63172) Or (strTemp = 65617) Or (strTemp = 65649) Then
      ReadAlpha = "Q-Z"
  ElseIf (strTemp >= 51387 And strTemp <= 51445) Or (strTemp = 65618) Or (strTemp = 65650) Then
      ReadAlpha = "R-Z"
  ElseIf (strTemp >= 51446 And strTemp <= 52217) Or (strTemp = 65619) Or (strTemp = 65651) Or (strTemp = 34009) Then
      ReadAlpha = "S-Z"
  ElseIf (strTemp >= 52218 And strTemp <= 52697) Or (strTemp = 65620) Or (strTemp = 65652) Then
      ReadAlpha = "T-Z"
  ElseIf (strTemp = 65621) Or (strTemp = 65653) Then
      ReadAlpha = "U-Z"
  ElseIf (strTemp = 65622) Or (strTemp = 65654) Then
      ReadAlpha = "V-Z"
  ElseIf (strTemp >= 52698 And strTemp <= 52979) Or (strTemp = 65623) Or (strTemp = 65655) Then
      ReadAlpha = "W-Z"
  ElseIf (strTemp >= 52980 And strTemp <= 53688) Or (strTemp = 65624) Or (strTemp = 65656) Then
      ReadAlpha = "X-Z"
  ElseIf (strTemp >= 53689 And strTemp <= 54480) Or (strTemp = 65625) Or (strTemp = 65657) Then
      ReadAlpha = "Y-Z"
  ElseIf (strTemp >= 54481 And strTemp <= 62383 And strTemp <> 59112 And strTemp <> 58838) Or (strTemp = 65626) Or (strTemp = 65658) Or (strTemp = 38395) Or (strTemp = 39783) Then
      ReadAlpha = "Z-Z"
  Else
      ReadAlpha = "A-9"
  End If
  If (strTemp >= 65633 And strTemp <= 65658) Or (strTemp >= 65601 And strTemp <= 65626) Then ReadAlpha = UCase(Left(str, 1))
  If (strTemp >= 65584 And strTemp <= 65593) Then ReadAlpha = "0-9"
    End Function
  • 打印文档
  • 推荐好友
  • 返回顶部
  • 增大字体
  • 减少字体
关于本站 | 工作机会 | 合作网站 | 广告服务 | 市场合作| 联系我们 | 抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved