在這裏你去,這應該做你需要的東西:
Private Function EncodeString(strOriginal as string) as string
Dim strTemp as string
strTemp = strOriginal
strTemp = Replace(strTemp, "ó", "ó")
strTemp = Replace(strTemp, "á", "á")
strTemp = Replace(strTemp, "é", "é")
strTemp = Replace(strTemp, "í", "í")
strTemp = Replace(strTemp, "ú", "ú")
strTemp = Replace(strTemp, "Á", "Á")
strTemp = Replace(strTemp, "É", "É")
strTemp = Replace(strTemp, "Í", "Í")
strTemp = Replace(strTemp, "Ó", "Ó")
strTemp = Replace(strTemp, "Ú", "Ú")
strTemp = Replace(strTemp, "¡", "¡")
strTemp = Replace(strTemp, "¢", "¢")
strTemp = Replace(strTemp, "£", "£")
strTemp = Replace(strTemp, "¤", "¤")
strTemp = Replace(strTemp, "¥", "¥")
strTemp = Replace(strTemp, "¦", "¦")
strTemp = Replace(strTemp, "§", "§")
strTemp = Replace(strTemp, "¨", "¨")
strTemp = Replace(strTemp, "©", "©")
strTemp = Replace(strTemp, "ª", "ª")
strTemp = Replace(strTemp, "«", "«")
strTemp = Replace(strTemp, "¬", "¬")
strTemp = Replace(strTemp, "®", "®")
strTemp = Replace(strTemp, "¯", "¯")
strTemp = Replace(strTemp, "°", "°")
strTemp = Replace(strTemp, "±", "±")
strTemp = Replace(strTemp, "²", "²")
strTemp = Replace(strTemp, "³", "³")
strTemp = Replace(strTemp, "´", "´")
strTemp = Replace(strTemp, "µ", "µ")
strTemp = Replace(strTemp, "¶", "¶")
strTemp = Replace(strTemp, "·", "·")
strTemp = Replace(strTemp, "¸", "¸")
strTemp = Replace(strTemp, "¹", "¹")
strTemp = Replace(strTemp, "º", "º")
strTemp = Replace(strTemp, "»", "»")
strTemp = Replace(strTemp, "¼", "¼")
strTemp = Replace(strTemp, "½", "½")
strTemp = Replace(strTemp, "¾", "¾")
strTemp = Replace(strTemp, "¿", "¿")
strTemp = Replace(strTemp, "×", "×")
strTemp = Replace(strTemp, "÷", "÷")
strTemp = Replace(strTemp, "À", "À")
strTemp = Replace(strTemp, "Â", "Â")
strTemp = Replace(strTemp, "Ã", "Ã")
strTemp = Replace(strTemp, "Ä", "Ä")
strTemp = Replace(strTemp, "Å", "Å")
strTemp = Replace(strTemp, "Æ", "Æ")
strTemp = Replace(strTemp, "Ç", "Ç")
strTemp = Replace(strTemp, "È", "È")
strTemp = Replace(strTemp, "Ê", "Ê")
strTemp = Replace(strTemp, "Ë", "Ë")
strTemp = Replace(strTemp, "Ì", "Ì")
strTemp = Replace(strTemp, "Î", "Î")
strTemp = Replace(strTemp, "Ï", "Ï")
strTemp = Replace(strTemp, "Ð", "Ð")
strTemp = Replace(strTemp, "Ñ", "Ñ")
strTemp = Replace(strTemp, "Ò", "Ò")
strTemp = Replace(strTemp, "Ô", "Ô")
strTemp = Replace(strTemp, "Õ", "Õ")
strTemp = Replace(strTemp, "Ö", "Ö")
strTemp = Replace(strTemp, "Ø", "Ø")
strTemp = Replace(strTemp, "Ù", "Ù")
strTemp = Replace(strTemp, "Û", "Û")
strTemp = Replace(strTemp, "Ü", "Ü")
strTemp = Replace(strTemp, "Ý", "Ý")
strTemp = Replace(strTemp, "Þ", "Þ")
strTemp = Replace(strTemp, "ß", "ß")
strTemp = Replace(strTemp, "à", "à")
strTemp = Replace(strTemp, "â", "â")
strTemp = Replace(strTemp, "ã", "ã")
strTemp = Replace(strTemp, "ä", "ä")
strTemp = Replace(strTemp, "å", "å")
strTemp = Replace(strTemp, "æ", "æ")
strTemp = Replace(strTemp, "ç", "ç")
strTemp = Replace(strTemp, "è", "è")
strTemp = Replace(strTemp, "ê", "ê")
strTemp = Replace(strTemp, "ë", "ë")
strTemp = Replace(strTemp, "ì", "ì")
strTemp = Replace(strTemp, "î", "î")
strTemp = Replace(strTemp, "ï", "ï")
strTemp = Replace(strTemp, "ð", "ð")
strTemp = Replace(strTemp, "ñ", "ñ")
strTemp = Replace(strTemp, "ò", "ò")
strTemp = Replace(strTemp, "ô", "ô")
strTemp = Replace(strTemp, "õ", "õ")
strTemp = Replace(strTemp, "ö", "ö")
strTemp = Replace(strTemp, "ø", "ø")
strTemp = Replace(strTemp, "ù", "ù")
strTemp = Replace(strTemp, "û", "û")
strTemp = Replace(strTemp, "ü", "ü")
strTemp = Replace(strTemp, "ý", "ý")
strTemp = Replace(strTemp, "þ", "þ")
strTemp = Replace(strTemp, "ÿ", "ÿ")
EncodeString = strTemp
End Function
我正想要這樣的事情,但我希望能找到更有效率或更「可愛」的東西。此外,這種方式很容易忘記一些,就像我看到的那樣,因爲'不在那裏。 –
另一種選擇是從文件加載它們,這會使代碼更清潔,但效率也會低得多。同樣,將它們存儲在某種數組中,然後循環遍歷數組在代碼中看起來會更好,但也會佔用更多的內存。 – EdoDodo
好啊。這個解決方案會做:)。我想我相信Acess可能已經實現了它,這是天真的。 –