Hey all,
I've got this program where I have to translate a word from English to Pig Latin. I'm sorta on the brink but I'm missing something.
the test words are "ant" and "chair" but they should then turn to "ant-WAY" and "air-chay"
but i'm ending up with "ant-anAY" and "air-ChAY"
and even further I know that I'm kinda cheating on the chair translation because it definitely won't work with any other word that doesn't start with a vowel. Finally is someone enters a numeric value like 56 it should show "56-WAY".
I'm stuck...any help? Code below
Private Sub xTranslateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xTranslateButton.Click
Dim strInput As String
Dim str1stCharacter As String
Dim strOutput As String
Dim intStringLength As Integer
strInput = Me.xEnterText.Text
str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1)
If str1stCharacter = "A" Or str1stCharacter = "E" _
Or str1stCharacter = "I" Or str1stCharacter = "O" _
Or str1stCharacter = "U" Or str1stCharacter = "Y" Then
strOutput = strInput & "-WAY"
Else
intStringLength = Len(strInput)
strOutput = Microsoft.VisualBasic.Right(strInput, 3) _
& "-" & Microsoft.VisualBasic.Left(strInput, 2) & "AY"
End If
Me.xAnswerLabel.Text = "The Pig Latin Translation of " & strInput & " is " & strOutput & "."
End Sub