我将此方法移植到VB.NET上了,请看源码(一)

80酷酷网    80kuku.com

  Public Class PinYin
    Private Shared a() As String = {"a", "ā", "á", "ǎ", "à"}
    Private Shared o() As String = {"o", "ō", "ó", "ǒ", "ò"}
    Private Shared e() As String = {"e", "ē", "é", "ě", "è"}
    Private Shared i() As String = {"i", "ī", "í", "ǐ", "ì"}
    Private Shared u() As String = {"u", "ū", "ú", "ǔ", "ù"}
    Private Shared v() As String = {"ü", "ǖ", "ǘ", "ǚ", "ǜ"}

    '是否强制转换:如果为真,即将标明声调的数字前的韵母根据标明声调的数字转换为相应的声调
    '如果为假,即根据拼音规则转换
    Private Shared mIsCompelled As Boolean = False
    Public Shared Property IsCompelled() As Boolean
        Get
            Return mIsCompelled
        End Get
        Set(ByVal Value As Boolean)
            mIsCompelled = Value
        End Set
    End Property
    Public Shared PyList As New System.Collections.SortedList()

#Region "拼音列表集合"
    Public Shared Function LoadPyChars() As System.Collections.SortedList
        If PyList.Count > 0 Then Exit Function
        PyList.Add("a", -20319)
        PyList.Add("ai", -20317)
        PyList.Add("an", -20304)
        PyList.Add("ang", -20295)
        PyList.Add("ao", -20292)
        PyList.Add("ba", -20283)
        PyList.Add("bai", -20265)
        PyList.Add("ban", -20257)
        PyList.Add("bang", -20242)
        PyList.Add("bao", -20230)
        PyList.Add("bei", -20051)
        PyList.Add("ben", -20036)
        PyList.Add("beng", -20032)
        PyList.Add("bi", -20026)
        PyList.Add("bian", -20002)
        PyList.Add("biao", -19990)
        PyList.Add("bie", -19986)
        PyList.Add("bin", -19982)
        PyList.Add("bing", -19976)
        PyList.Add("bo", -19805)
        PyList.Add("bu", -19784)
        PyList.Add("ca", -19775)
        PyList.Add("cai", -19774)
        PyList.Add("can", -19763)
        PyList.Add("cang", -19756)
        PyList.Add("cao", -19751)
        PyList.Add("ce", -19746)
        PyList.Add("ceng", -19741)
        PyList.Add("cha", -19739)
        PyList.Add("chai", -19728)
        PyList.Add("chan", -19725)
        PyList.Add("chang", -19715)
        PyList.Add("chao", -19540)
        PyList.Add("che", -19531)
        PyList.Add("chen", -19525)
        PyList.Add("cheng", -19515)
        PyList.Add("chi", -19500)
        PyList.Add("chong", -19484)
        PyList.Add("chou", -19479)
        PyList.Add("chu", -19467)
        PyList.Add("chuai", -19289)
        PyList.Add("chuan", -19288)
        PyList.Add("chuang", -19281)
        PyList.Add("chui", -19275)
        PyList.Add("chun", -19270)
        PyList.Add("chuo", -19263)
        PyList.Add("ci", -19261)
        PyList.Add("cong", -19249)
        PyList.Add("cou", -19243)
        PyList.Add("cu", -19242)
        PyList.Add("cuan", -19238)
        PyList.Add("cui", -19235)
        PyList.Add("cun", -19227)
        PyList.Add("cuo", -19224)
        PyList.Add("da", -19218)
        PyList.Add("dai", -19212)
        PyList.Add("dan", -19038)
        PyList.Add("dang", -19023)
        PyList.Add("dao", -19018)
        PyList.Add("de", -19006)
        PyList.Add("deng", -19003)
        PyList.Add("di", -18996)
        PyList.Add("dian", -18977)
        PyList.Add("diao", -18961)
        PyList.Add("die", -18952)
        PyList.Add("ding", -18783)
        PyList.Add("diu", -18774)
        PyList.Add("dong", -18773)
        PyList.Add("dou", -18763)
        PyList.Add("du", -18756)
        PyList.Add("duan", -18741)
        PyList.Add("dui", -18735)
        PyList.Add("dun", -18731)
        PyList.Add("duo", -18722)
        PyList.Add("e", -18710)
        PyList.Add("en", -18697)
        PyList.Add("er", -18696)
        PyList.Add("fa", -18526)
        PyList.Add("fan", -18518)
        PyList.Add("fang", -18501)
        PyList.Add("fei", -18490)
        PyList.Add("fen", -18478)
        PyList.Add("feng", -18463)
        PyList.Add("fo", -18448)
        PyList.Add("fou", -18447)
        PyList.Add("fu", -18446)
        PyList.Add("ga", -18239)
        PyList.Add("gai", -18237)
        PyList.Add("gan", -18231)
        PyList.Add("gang", -18220)
        PyList.Add("gao", -18211)
        PyList.Add("ge", -18201)
        PyList.Add("gei", -18184)
        PyList.Add("gen", -18183)
        PyList.Add("geng", -18181)
        PyList.Add("gong", -18012)
        PyList.Add("gou", -17997)
        PyList.Add("gu", -17988)
        PyList.Add("gua", -17970)
        PyList.Add("guai", -17964)
        PyList.Add("guan", -17961)
        PyList.Add("guang", -17950)
        PyList.Add("gui", -17947)
        PyList.Add("gun", -17931)
        PyList.Add("guo", -17928)
        PyList.Add("ha", -17922)
        PyList.Add("hai", -17759)
        PyList.Add("han", -17752)
        PyList.Add("hang", -17733)
        PyList.Add("hao", -17730)
        PyList.Add("he", -17721)
        PyList.Add("hei", -17703)
        PyList.Add("hen", -17701)
        PyList.Add("heng", -17697)
        PyList.Add("hong", -17692)
        PyList.Add("hou", -17683)
        PyList.Add("hu", -17676)
        PyList.Add("hua", -17496)
        PyList.Add("huai", -17487)
        PyList.Add("huan", -17482)
        PyList.Add("huang", -17468)
        PyList.Add("hui", -17454)
        PyList.Add("hun", -17433)
        PyList.Add("huo", -17427)
        PyList.Add("ji", -17417)
        PyList.Add("jia", -17202)
        PyList.Add("jian", -17185)
        PyList.Add("jiang", -16983)
        PyList.Add("jiao", -16970)
        PyList.Add("jie", -16942)
        PyList.Add("jin", -16915)
        PyList.Add("jing", -16733)
        PyList.Add("jiong", -16708)
        PyList.Add("jiu", -16706)
        PyList.Add("ju", -16689)
        PyList.Add("juan", -16664)
        PyList.Add("jue", -16657)
        PyList.Add("jun", -16647)
        PyList.Add("ka", -16474)
        PyList.Add("kai", -16470)
        PyList.Add("kan", -16465)
        PyList.Add("kang", -16459)
        PyList.Add("kao", -16452)
        PyList.Add("ke", -16448)
        PyList.Add("ken", -16433)
        PyList.Add("keng", -16429)
        PyList.Add("kong", -16427)
        PyList.Add("kou", -16423)
        PyList.Add("ku", -16419)
        PyList.Add("kua", -16412)
        PyList.Add("kuai", -16407)
        PyList.Add("kuan", -16403)
        PyList.Add("kuang", -16401)
        PyList.Add("kui", -16393)
        PyList.Add("kun", -16220)
        PyList.Add("kuo", -16216)
        PyList.Add("la", -16212)
        PyList.Add("lai", -16205)
        PyList.Add("lan", -16202)
        PyList.Add("lang", -16187)
        PyList.Add("lao", -16180)
        PyList.Add("le", -16171)
        PyList.Add("lei", -16169)
        PyList.Add("leng", -16158)
        PyList.Add("li", -16155)
        PyList.Add("lia", -15959)
        PyList.Add("lian", -15958)
        PyList.Add("liang", -15944)
        PyList.Add("liao", -15933)
        PyList.Add("lie", -15920)
        PyList.Add("lin", -15915)
        PyList.Add("ling", -15903)
        PyList.Add("liu", -15889)
        PyList.Add("long", -15878)
        PyList.Add("lou", -15707)
        PyList.Add("lu", -15701)
        PyList.Add("lv", -15681)
        PyList.Add("luan", -15667)
        PyList.Add("lue", -15661)
        PyList.Add("lun", -15659)
        PyList.Add("luo", -15652)
        PyList.Add("ma", -15640)
        PyList.Add("mai", -15631)
        PyList.Add("man", -15625)
        PyList.Add("mang", -15454)
        PyList.Add("mao", -15448)
        PyList.Add("me", -15436)
        PyList.Add("mei", -15435)
        PyList.Add("men", -15419)
        PyList.Add("meng", -15416)
        PyList.Add("mi", -15408)
        PyList.Add("mian", -15394)
        PyList.Add("miao", -15385)
        PyList.Add("mie", -15377)
        PyList.Add("min", -15375)
        PyList.Add("ming", -15369)
        PyList.Add("miu", -15363)
        PyList.Add("mo", -15362)
        PyList.Add("mou", -15183)
        PyList.Add("mu", -15180)
        PyList.Add("na", -15165)
        PyList.Add("nai", -15158)
        PyList.Add("nan", -15153)
        PyList.Add("nang", -15150)
        PyList.Add("nao", -15149)
        PyList.Add("ne", -15144)
        PyList.Add("nei", -15143)
        PyList.Add("nen", -15141)
        PyList.Add("neng", -15140)
        PyList.Add("ni", -15139)
        PyList.Add("nian", -15128)
        PyList.Add("niang", -15121)
        PyList.Add("niao", -15119)
        PyList.Add("nie", -15117)
        PyList.Add("nin", -15110)
        PyList.Add("ning", -15109)
        PyList.Add("niu", -14941)
        PyList.Add("nong", -14937)
        PyList.Add("nu", -14933)
        PyList.Add("nv", -14930)
        PyList.Add("nuan", -14929)
        PyList.Add("nue", -14928)
        PyList.Add("nuo", -14926)
        PyList.Add("o", -14922)
        PyList.Add("ou", -14921)
        PyList.Add("pa", -14914)
        PyList.Add("pai", -14908)
        PyList.Add("pan", -14902)
        PyList.Add("pang", -14894)
        PyList.Add("pao", -14889)
        PyList.Add("pei", -14882)
        PyList.Add("pen", -14873)
        PyList.Add("peng", -14871)
        PyList.Add("pi", -14857)
        PyList.Add("pian", -14678)
        PyList.Add("piao", -14674)
        PyList.Add("pie", -14670)
        PyList.Add("pin", -14668)
        PyList.Add("ping", -14663)
        PyList.Add("po", -14654)
        PyList.Add("pu", -14645)
        PyList.Add("qi", -14630)
        PyList.Add("qia", -14594)
        PyList.Add("qian", -14429)
        PyList.Add("qiang", -14407)
        PyList.Add("qiao", -14399)
        PyList.Add("qie", -14384)
        PyList.Add("qin", -14379)
        PyList.Add("qing", -14368)
        PyList.Add("qiong", -14355)
        PyList.Add("qiu", -14353)
        PyList.Add("qu", -14345)
        PyList.Add("quan", -14170)
        PyList.Add("que", -14159)
        PyList.Add("qun", -14151)
        PyList.Add("ran", -14149)
        PyList.Add("rang", -14145)
        PyList.Add("rao", -14140)
        PyList.Add("re", -14137)
        PyList.Add("ren", -14135)
        PyList.Add("reng", -14125)
        PyList.Add("ri", -14123)
        PyList.Add("rong", -14122)
        PyList.Add("rou", -14112)
        PyList.Add("ru", -14109)
        PyList.Add("ruan", -14099)
        PyList.Add("rui", -14097)
        PyList.Add("run", -14094)
        PyList.Add("ruo", -14092)
        PyList.Add("sa", -14090)
        PyList.Add("sai", -14087)
        PyList.Add("san", -14083)
        PyList.Add("sang", -13917)
        PyList.Add("sao", -13914)
        PyList.Add("se", -13910)
        PyList.Add("sen", -13907)
        PyList.Add("seng", -13906)
        PyList.Add("sha", -13905)
        PyList.Add("shai", -13896)
        PyList.Add("shan", -13894)
        PyList.Add("shang", -13878)
        PyList.Add("shao", -13870)
        PyList.Add("she", -13859)
        PyList.Add("shen", -13847)
        PyList.Add("sheng", -13831)
        PyList.Add("shi", -13658)
        PyList.Add("shou", -13611)
        PyList.Add("shu", -13601)
        PyList.Add("shua", -13406)
        PyList.Add("shuai", -13404)
        PyList.Add("shuan", -13400)
        PyList.Add("shuang", -13398)
        PyList.Add("shui", -13395)
        PyList.Add("shun", -13391)
        PyList.Add("shuo", -13387)
        PyList.Add("si", -13383)
        PyList.Add("song", -13367)
        PyList.Add("sou", -13359)
        PyList.Add("su", -13356)
        PyList.Add("suan", -13343)
        PyList.Add("sui", -13340)
        PyList.Add("sun", -13329)
        PyList.Add("suo", -13326)
        PyList.Add("ta", -13318)
        PyList.Add("tai", -13147)
        PyList.Add("tan", -13138)
        PyList.Add("tang", -13120)
        PyList.Add("tao", -13107)
        PyList.Add("te", -13096)
        PyList.Add("teng", -13095)
        PyList.Add("ti", -13091)
        PyList.Add("tian", -13076)
        PyList.Add("tiao", -13068)
        PyList.Add("tie", -13063)
        PyList.Add("ting", -13060)
        PyList.Add("tong", -12888)
        PyList.Add("tou", -12875)
        PyList.Add("tu", -12871)
        PyList.Add("tuan", -12860)
        PyList.Add("tui", -12858)
        PyList.Add("tun", -12852)
        PyList.Add("tuo", -12849)
        PyList.Add("wa", -12838)
        PyList.Add("wai", -12831)
        PyList.Add("wan", -12829)
        PyList.Add("wang", -12812)
        PyList.Add("wei", -12802)
        PyList.Add("wen", -12607)
        PyList.Add("weng", -12597)
        PyList.Add("wo", -12594)
        PyList.Add("wu", -12585)
        PyList.Add("xi", -12556)
        PyList.Add("xia", -12359)
        PyList.Add("xian", -12346)
        PyList.Add("xiang", -12320)
        PyList.Add("xiao", -12300)
        PyList.Add("xie", -12120)
        PyList.Add("xin", -12099)
        PyList.Add("xing", -12089)
        PyList.Add("xiong", -12074)
        PyList.Add("xiu", -12067)
        PyList.Add("xu", -12058)
        PyList.Add("xuan", -12039)
        PyList.Add("xue", -11867)
        PyList.Add("xun", -11861)
        PyList.Add("ya", -11847)
        PyList.Add("yan", -11831)
        PyList.Add("yang", -11798)
        PyList.Add("yao", -11781)
        PyList.Add("ye", -11604)
        PyList.Add("yi", -11589)
        PyList.Add("yin", -11536)
        PyList.Add("ying", -11358)
        PyList.Add("yo", -11340)
        PyList.Add("yong", -11339)
        PyList.Add("you", -11324)
        PyList.Add("yu", -11303)
        PyList.Add("yuan", -11097)
        PyList.Add("yue", -11077)
        PyList.Add("yun", -11067)
        PyList.Add("za", -11055)
        PyList.Add("zai", -11052)
        PyList.Add("zan", -11045)
        PyList.Add("zang", -11041)
        PyList.Add("zao", -11038)
        PyList.Add("ze", -11024)
        PyList.Add("zei", -11020)
        PyList.Add("zen", -11019)
        PyList.Add("zeng", -11018)
        PyList.Add("zha", -11014)
        PyList.Add("zhai", -10838)
        PyList.Add("zhan", -10832)
        PyList.Add("zhang", -10815)
        PyList.Add("zhao", -10800)
        PyList.Add("zhe", -10790)
        PyList.Add("zhen", -10780)
        PyList.Add("zheng", -10764)
        PyList.Add("zhi", -10587)
        PyList.Add("zhong", -10544)
        PyList.Add("zhou", -10533)
        PyList.Add("zhu", -10519)
        PyList.Add("zhua", -10331)
        PyList.Add("zhuai", -10329)
        PyList.Add("zhuan", -10328)
        PyList.Add("zhuang", -10322)
        PyList.Add("zhui", -10315)
        PyList.Add("zhun", -10309)
        PyList.Add("zhuo", -10307)
        PyList.Add("zi", -10296)
        PyList.Add("zong", -10281)
        PyList.Add("zou", -10274)
        PyList.Add("zu", -10270)
        PyList.Add("zuan", -10262)
        PyList.Add("zui", -10260)
        PyList.Add("zun", -10256)
        PyList.Add("zuo", -10254)
        Return PyList
    End Function
#End Region

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: