获取汉字拼音的第一个字母

2016-02-19 18:57 8 1 收藏

关注图老师设计创意栏目可以让大家能更好的了解电脑,知道有关于电脑的更多有趣教程,今天给大家分享获取汉字拼音的第一个字母教程,希望对大家能有一点小小的帮助。

【 tulaoshi.com - Web开发 】

  script language="vbs" src="spellcode.vbs"/script

  
  '获取客户简称的拼音缩写
              function getpy()
                  dim str
                  dim i
                  str=document.all.txtContactName.value
                  dim ret
                  for i=1 to len(str)
                      ret=ret&getpychar(mid(str,i,1))
                  next
                  document.all.txtSpellCode.value=ret
          end function
      getpychar=char
      end if
  end function
  spellCode.vbs

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

  
  '获取汉字拼音第一字母
  function getpychar(char)
      dim tmp
      tmp=65536+asc(char)
      if(tmp=45217 and tmp=45252) then 
      getpychar= "A"
      elseif(tmp=45253 and tmp=45760) then
      getpychar= "B"
      elseif(tmp=45761 and tmp=46317) then
      getpychar= "C"
      elseif(tmp=46318 and tmp=46825) then
      getpychar= "D"
      elseif(tmp=46826 and tmp=47009) then 
      getpychar= "E"
      elseif(tmp=47010 and tmp=47296) then 
      getpychar= "F"
      elseif(tmp=47297 and tmp=47613) then 
      getpychar= "G"
      elseif(tmp=47614 and tmp=48118) then
      getpychar= "H"
      elseif(tmp=48119 and tmp=49061) then
      getpychar= "J"
      elseif(tmp=49062 and tmp=49323) then 
      getpychar= "K"
      elseif(tmp=49324 and tmp=49895) then 
      getpychar= "L"
      elseif(tmp=49896 and tmp=50370) then 
      getpychar= "M"
      elseif(tmp=50371 and tmp=50613) then 
      getpychar= "N"
      elseif(tmp=50614 and tmp=50621) then 
      getpychar= "O"
      elseif(tmp=50622 and tmp=50905) then
      getpychar= "P"
      elseif(tmp=50906 and tmp=51386) then 
      getpychar= "Q"
      elseif(tmp=51387 and tmp=51445) then 
      getpychar= "R"
      elseif(tmp=51446 and tmp=52217) then 
      getpychar= "S"
      elseif(tmp=52218 and tmp=52697) then 
      getpychar= "T"
      elseif(tmp=52698 and tmp=52979) then 
      getpychar= "W"
      elseif(tmp=52980 and tmp=53688) then 
      getpychar= "X"
      elseif(tmp=53689 and tmp=54480) then 
      getpychar= "Y"
      elseif(tmp=54481 and tmp=62289) then
      getpychar= "Z"
      else '如果不是中文,则不处理
      getpychar=char
      end if
  end function

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

来源:https://www.tulaoshi.com/n/20160219/1619611.html

延伸阅读
http://community.csdn.net/EXPert/topic/3517/3517995.XML?temp=.2898371 这是我的第一个Struts应用,仅仅用于用户注册;注册的用户存入数据库中。 参考《jsp应用开发详解》电子工业出版社 PART I/III /** SQL Server 2000 Tomcat 4.1 Struts jakarta-struts-1.1 Editplus */ //----数据库脚...
获取字符串中的汉字拼音首字母(根据http://blog.csdn.net/iwebsms/archive/2004/09/28/119851.aspx修改) 可能代码比较臃肿,希望有朋友再帮忙改正   //返回给定字符串的首字母   private String IndexCode(String IndexTxt)   {    String _Temp=null;  &nb...
标签: Java JAVA基础
  第一个JSP 实际上,JSP只是简单地将Java放到HTML网页中去而已。你可以将现有的HTML网页将它们的扩展名由“.html”改为“.jsp”,这是一个创建第一个JSP最好的方法。 我们可以将上一个练习中的文件将它的扩展名由“.html”改为“.jsp”。然后在浏览器中装载新的文件,即以“.jsp”为扩展名的文件。 此时,你可以看到的输出,但是它需...
二、在Eclipse中生成POLO和映射文件 1) 在Eclipse中配置环境,包括数据库驱动程序(此处略) 2) 生成POLO类和映射文件 此处以Houses为例,生成的原代码和映射文件如下: a) hibernate.cfg.xml ?xml version=´1.0´ encoding=´UTF-8´? !DOCTYPE hibernate-configuration PUBLIC "-...
标签: 瑜伽 养生 健康
     瑜伽的呼吸法通过有意识地呼吸得以排除体内的废气和虚火以及消除紧张和疲劳。 预防慢性病 别以为只有肌肉和骨骼会疲倦外在身体的疲倦可通过你的双手的按摩而达到舒缓其实人体的脏器也会产生怠惰疲倦之感.而借由瑜伽各种体位法的姿势按摩身体的内部器官不仅可促进血液循环伸展僵硬的肌肉使关节灵活外还可以...

经验教程

988

收藏

27
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部