- Αυτό το θέμα είναι κενό.
-
ΣυντάκτηςΔημοσιεύσεις
-
07/11/2022 στις 21:36 #15815Τσάκου ΓεωργίαΣυντονιστής
Κώδικας Visual Basic για την μετατροπή Ελληνικών χαρακτήρων σε Αγγλικούς. Ο κώδικας κάνει και το αντίστροφο, δηλαδή μετατρέπει και τους Αγγλικούς σε Ελληνικούς. Παράλληλα τους φθόγγους μπ, ντ και γκ τους μετατρέπει στα αντίστοιχα αγγλικά γράμματα.
Οποιαδήποτε βοήθεια καλοδεχούμενη…
Με την πολύτιμη βοήθεια του
- Κυριάκου Αποστολίδη
- http://www.adaeion.gr/word/c/convert_characters_macro.html
Function ChangeLang(StringToEncode As String) As String
Dim i As Integer
Dim StringSize As Integer
Dim TranslatedString As String
Dim CurrentChar As String
Dim NextChar As String
Dim CurrentNextChar As StringTranslatedString = “”
StringSize = Len(StringToEncode)For i = 1 To StringSize
CurrentChar = Mid(StringToEncode, i, 1)
If i <> StringSize Then
NextChar = Mid(StringToEncode, i + 1, 1)
CurrentNextChar = Translate(CurrentChar) & Translate(NextChar)
If CurrentNextChar = “mp” Then
CurrentChar = “b”
i = i + 1
ElseIf CurrentNextChar = “nt” Then
CurrentChar = “d”
i = i + 1
ElseIf CurrentNextChar = “gk” Then
CurrentChar = “g”
i = i + 1
End If
End If
TranslatedString = TranslatedString & Translate(CurrentChar)
NextChangeLang = TranslatedString
End Function
Function Translate(InputStr As String) As String
Dim OutputStr As StringSelect Case (InputStr)
‘ SPACE remains the same (for speed added here)
Case ” “: OutputStr = ” ”‘ Wanted Greek but used English keyboard (lower case)
‘ Case “;a”: OutputStr = “ά”
‘ Case “;e”: OutputStr = “έ”
‘ Case “;h”: OutputStr = “ή”
‘ Case “;i”: OutputStr = “ί”
‘ Case “;o”: OutputStr = “ό”
‘ Case “;y”: OutputStr = “ύ”
‘ Case “;v”: OutputStr = “ώ”
‘
‘ Case “:i”: OutputStr = “ϊ”
‘ Case “:y”: OutputStr = “ϋ”
‘
‘ Case “q”: OutputStr = “;”
‘ Case “w”: OutputStr = “ς”
‘ Case “e”: OutputStr = “ε”
‘ Case “r”: OutputStr = “ρ”
‘ Case “t”: OutputStr = “τ”
‘ Case “y”: OutputStr = “υ”
‘ Case “u”: OutputStr = “θ”
‘ Case “i”: OutputStr = “ι”
‘ Case “o”: OutputStr = “ο”
‘ Case “p”: OutputStr = “π”
‘ Case “a”: OutputStr = “α”
‘ Case “s”: OutputStr = “σ”
‘ Case “d”: OutputStr = “δ”
‘ Case “f”: OutputStr = “φ”
‘ Case “g”: OutputStr = “γ”
‘ Case “h”: OutputStr = “η”
‘ Case “j”: OutputStr = “ξ”
‘ Case “k”: OutputStr = “κ”
‘ Case “l”: OutputStr = “λ”
‘ Case “z”: OutputStr = “ζ”
‘ Case “x”: OutputStr = “χ”
‘ Case “c”: OutputStr = “ψ”
‘ Case “v”: OutputStr = “ω”
‘ Case “b”: OutputStr = “β”
‘ Case “n”: OutputStr = “ν”
‘ Case “m”: OutputStr = “μ”‘ Wanted Greek but used English keyboard (lower case)
Case “q”: OutputStr = “q”
Case “w”: OutputStr = “w”
Case “e”: OutputStr = “e”
Case “r”: OutputStr = “r”
Case “t”: OutputStr = “t”
Case “y”: OutputStr = “y”
Case “u”: OutputStr = “u”
Case “i”: OutputStr = “i”
Case “o”: OutputStr = “o”
Case “p”: OutputStr = “p”
Case “a”: OutputStr = “a”
Case “s”: OutputStr = “s”
Case “d”: OutputStr = “d”
Case “f”: OutputStr = “f”
Case “g”: OutputStr = “g”
Case “h”: OutputStr = “h”
Case “j”: OutputStr = “j”
Case “k”: OutputStr = “k”
Case “l”: OutputStr = “l”
Case “z”: OutputStr = “z”
Case “x”: OutputStr = “x”
Case “c”: OutputStr = “c”
Case “v”: OutputStr = “v”
Case “b”: OutputStr = “b”
Case “n”: OutputStr = “n”
Case “m”: OutputStr = “m”‘ Wanted English but used Greek keyboard (lower case)
Case “ά”: OutputStr = “a”
Case “έ”: OutputStr = “e”
Case “ή”: OutputStr = “i”
Case “ί”: OutputStr = “i”
Case “ό”: OutputStr = “o”
Case “ύ”: OutputStr = “u”
Case “ώ”: OutputStr = “o”Case “ϊ”: OutputStr = “i”
Case “ϋ”: OutputStr = “y”
Case “ΐ”: OutputStr = “i”
Case “ΰ”: OutputStr = “y”Case “;”: OutputStr = “q”
Case “ς”: OutputStr = “s”
Case “ε”: OutputStr = “e”
Case “ρ”: OutputStr = “r”
Case “τ”: OutputStr = “t”
Case “υ”: OutputStr = “u”
Case “θ”: OutputStr = “th”
Case “ι”: OutputStr = “i”
Case “ο”: OutputStr = “o”
Case “π”: OutputStr = “p”
Case “α”: OutputStr = “a”
Case “σ”: OutputStr = “s”
Case “δ”: OutputStr = “d”
Case “φ”: OutputStr = “f”
Case “γ”: OutputStr = “g”
Case “η”: OutputStr = “i”
Case “ξ”: OutputStr = “x”
Case “κ”: OutputStr = “k”
Case “λ”: OutputStr = “l”
Case “ζ”: OutputStr = “z”
Case “χ”: OutputStr = “x”
Case “ψ”: OutputStr = “ps”
Case “ω”: OutputStr = “o”
Case “β”: OutputStr = “b”
Case “ν”: OutputStr = “n”
Case “μ”: OutputStr = “m”‘ Wanted Greek but used English keyboard (upper case)
‘ Case “;A”: OutputStr = “Ά”
‘ Case “;E”: OutputStr = “Έ”
‘ Case “;H”: OutputStr = “Ή”
‘ Case “;I”: OutputStr = “Ί”
‘ Case “;O”: OutputStr = “Ό”
‘ Case “;Y”: OutputStr = “Ύ”
‘ Case “;V”: OutputStr = “Ώ”
‘
‘ Case “:I”: OutputStr = “Ϊ”
‘ Case “:Y”: OutputStr = “Ϋ”
‘
‘ Case “Q”: OutputStr = “:”
‘ Case “W”: OutputStr = “΅”
‘ Case “E”: OutputStr = “Ε”
‘ Case “R”: OutputStr = “Ρ”
‘ Case “T”: OutputStr = “Τ”
‘ Case “Y”: OutputStr = “Υ”
‘ Case “U”: OutputStr = “Θ”
‘ Case “I”: OutputStr = “Ι”
‘ Case “O”: OutputStr = “Ο”
‘ Case “P”: OutputStr = “Π”
‘ Case “A”: OutputStr = “Α”
‘ Case “S”: OutputStr = “Σ”
‘ Case “D”: OutputStr = “Δ”
‘ Case “F”: OutputStr = “Φ”
‘ Case “G”: OutputStr = “Γ”
‘ Case “H”: OutputStr = “Η”
‘ Case “J”: OutputStr = “Ξ”
‘ Case “K”: OutputStr = “Κ”
‘ Case “L”: OutputStr = “Λ”
‘ Case “Z”: OutputStr = “Ζ”
‘ Case “X”: OutputStr = “Χ”
‘ Case “C”: OutputStr = “Ψ”
‘ Case “V”: OutputStr = “Ω”
‘ Case “B”: OutputStr = “Β”
‘ Case “N”: OutputStr = “Ν”
‘ Case “M”: OutputStr = “Μ”Case “Q”: OutputStr = “Q”
Case “W”: OutputStr = “W”
Case “E”: OutputStr = “E”
Case “R”: OutputStr = “R”
Case “T”: OutputStr = “T”
Case “Y”: OutputStr = “Y”
Case “U”: OutputStr = “U”
Case “I”: OutputStr = “I”
Case “O”: OutputStr = “O”
Case “P”: OutputStr = “P”
Case “A”: OutputStr = “A”
Case “S”: OutputStr = “S”
Case “D”: OutputStr = “D”
Case “F”: OutputStr = “F”
Case “G”: OutputStr = “G”
Case “H”: OutputStr = “H”
Case “J”: OutputStr = “J”
Case “K”: OutputStr = “K”
Case “L”: OutputStr = “L”
Case “Z”: OutputStr = “Z”
Case “X”: OutputStr = “C”
Case “C”: OutputStr = “C”
Case “V”: OutputStr = “V”
Case “B”: OutputStr = “B”
Case “N”: OutputStr = “N”
Case “M”: OutputStr = “M”‘ Wanted English but used Greek keyboard (upper case)
Case “:”: OutputStr = “Q”
Case “΅”: OutputStr = “W”
Case “Ε”: OutputStr = “E”
Case “Ρ”: OutputStr = “R”
Case “Τ”: OutputStr = “T”
Case “Υ”: OutputStr = “Y”
Case “Θ”: OutputStr = “ΤΗ”
Case “Ι”: OutputStr = “I”
Case “Ο”: OutputStr = “O”
Case “Π”: OutputStr = “P”
Case “Α”: OutputStr = “A”
Case “Σ”: OutputStr = “S”
Case “Δ”: OutputStr = “D”
Case “Φ”: OutputStr = “F”
Case “Γ”: OutputStr = “G”
Case “Η”: OutputStr = “Ι”
Case “Ξ”: OutputStr = “Χ”
Case “Κ”: OutputStr = “K”
Case “Λ”: OutputStr = “L”
Case “Ζ”: OutputStr = “Z”
Case “Χ”: OutputStr = “X”
Case “Ψ”: OutputStr = “PS”
Case “Ω”: OutputStr = “O”
Case “Β”: OutputStr = “B”
Case “Ν”: OutputStr = “N”
Case “Μ”: OutputStr = “M”Case Else: OutputStr = InputStr
End Select
Translate = OutputStr
End Function
-
ΣυντάκτηςΔημοσιεύσεις
Πρέπει να είστε συνδεδεμένοι για να απαντήσετε σ' αυτό το θέμα. Login here