|
Option Explicit
Private Sub Form_Load()
Text1.Text = "Über fröhliche Beiträge können sich alle " & _
"glücklich schätzen." & vbCrLf & vbCrLf & _
"Für Konfitüre müssen die Äpfel üblicherweise " & _
"geschält werden."
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
Text2.Text = Konvert(Text1.Text)
Text1.Text = vbNullString
Case 1
Text1.Text = Konvert(Text2.Text, 1)
Text2.Text = vbNullString
End Select
Command1(1).Enabled = Command1(1).Enabled Xor -1
Command1(0).Enabled = Command1(0).Enabled Xor -1
End Sub
Function Konvert(ByVal strTxt As String, _
Optional Richtung As Byte) As String
Dim S(5, 1) As String
Dim strT As String
Dim lngM As Long
Dim intN As Integer
S(0, 0) = "ä"
S(0, 1) = "ae"
S(1, 0) = "ö"
S(1, 1) = "oe"
S(2, 0) = "ü"
S(2, 1) = "ue"
S(3, 0) = "Ä"
S(3, 1) = "AE"
S(4, 0) = "Ö"
S(4, 1) = "OE"
S(5, 0) = "Ü"
S(5, 1) = "UE"
lngM = 0
Do
lngM = lngM + 1
If lngM > Len(strTxt) Then Exit Do
For intN = 0 To UBound(S)
Select Case Richtung
Case 0
strT = Mid(strTxt, lngM, 1)
If strT = S(intN, 0) Then
strTxt = Left(strTxt, lngM - 1) & S(intN, 1) & _
Mid(strTxt, lngM + 1)
lngM = lngM + 1
End If
Case 1
strT = Mid(strTxt, lngM, 2)
If Left(strT, 1) = UCase(Left(strT, 1)) Then
strT = UCase(strT)
End If
If strT = S(intN, 1) Then
strTxt = Left(strTxt, lngM - 1) & S(intN, 0) & _
Mid(strTxt, lngM + 2)
lngM = lngM + 1
End If
End Select
Next
Loop
Konvert = strTxt
End Function
|
|