Excel將取出漢子首字母

2021-09-26 21:46:13 字數 2305 閱讀 8170

第一步

第二步

第三步

第五步:在execl中 ,模組中  複製下列** :

function hztopy(hzpy as string) as string

dim hzstring as string, pystring as string

dim hzpysum as integer, hzi as integer, hzpyhex as integer

hzstring = trim(hzpy)

hzpysum = len(trim(hzstring))

pystring = ""

for hzi = 1 to hzpysum

hzpyhex = "&h" + hex(asc(mid(hzstring, hzi, 1)))

select case hzpyhex

case &hb0a1 to &hb0c4: pystring = pystring + "a"

case &hb0c5 to &hb2c0: pystring = pystring + "b"

case &hb2c1 to &hb4ed: pystring = pystring + "c"

case &hb4ee to &hb6e9: pystring = pystring + "d"

case &hb6ea to &hb7a1: pystring = pystring + "e"

case &hb7a2 to &hb8c0: pystring = pystring + "f"

case &hb8c1 to &hb9fd: pystring = pystring + "g"

case &hb9fe to &hbbf6: pystring = pystring + "h"

case &hbbf7 to &hbfa5: pystring = pystring + "j"

case &hbfa6 to &hc0ab: pystring = pystring + "k"

case &hc0ac to &hc2e7: pystring = pystring + "l"

case &hc2e8 to &hc4c2: pystring = pystring + "m"

case &hc4c3 to &hc5b5: pystring = pystring + "n"

case &hc5b6 to &hc5bd: pystring = pystring + "o"

case &hc5be to &hc6d9: pystring = pystring + "p"

case &hc6da to &hc8ba: pystring = pystring + "q"

case &hc8bb to &hc8f5: pystring = pystring + "r"

case &hc8f6 to &hcbf9: pystring = pystring + "s"

case &hcbfa to &hcdd9: pystring = pystring + "t"

case &hedc5: pystring = pystring + "t"

case &hcdda to &hcef3: pystring = pystring + "w"

case &hcef4 to &hd1b8: pystring = pystring + "x"

case &hd1b9 to &hd4d0: pystring = pystring + "y"

case &hd4d1 to &hd7f9: pystring = pystring + "z"

case else

pystring = pystring + mid(hzstring, hzi, 1)

end select

next

hztopy = pystring

end function

這個時候不要關閉剛才快捷鍵alt+f11的視窗,返回到需要處理的文字視窗,做如下操作

比如在a1輸入  阿奇黴素   則在其他空白單元格輸入  =hztopy(a1)    回車執行即可.

java獲取漢子首字母

public class stringutil 存放國標一級漢字不同讀音的起始區位碼對應讀音 static final char firstletter 獲取乙個字串的拼音碼 public static string getfirstletter string oristr byte unicode...

Excel 取得漢字拼音首字母

最近寫 需要用到將一些漢字的首字母作為列舉型的要求,網上看到了這個方法,在excel vb指令碼中使用,在這記錄下 下面是乙個vba自定義函式,按alt f11,插入模組,在右面視窗中貼上下面 若b10內容為 中國航天6號a,則在某空白格中輸入 hztopy b10 即可 function hzto...

首字母大寫

對乙個字串中的所有單詞,如果單詞的首字母不是大寫字母,則把單詞的首字母變成大寫字母。在字串中,單詞之間通過空白符分隔,空白符包括 空格 製表符 t 回車符 r 換行符 n 輸入一行 待處理的字串 長度小於100 可能有多組測試資料,對於每組資料,輸出一行 轉換後的字串 輸入可以接受空格,回車等空白符...