I am making a program for a pig latin converter. if the word begins with a vowel add -way at the end if it does not begin with a vowel then add a dash to the end of the word until the first letter in the word is aeiouy then add ay to the end like chair would be air-chay. as of now all of my words are ending in way when I push my convert button
this is what I have so far any help would be appreciated
Code:
Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click
' declare the variables
Dim strWord As String
'trim the input
strWord = txtWordenter.Text.Trim
If strWord = "" Then
MessageBox.Show("Please Enter a Word")
End If
If strWord <> Nothing Then
End If
' if input begins with a vowel
If strWord.ToString Like "[aeiou]*" Then
Call Convert_To_Pig(strWord)
Else
' if input begins with nonvowel
Call insertAy(strWord)
End If
' send focus to input
txtWordenter.SelectAll()
End Sub
Private Sub Convert_To_Pig(ByVal convertWord As String)
'function will put -way to words that have vowels
Const Vowel As String = "-way"
txtConvertedword.Text = convertWord & Vowel
End Sub
Private Sub insertAy(ByRef word As String)
' sees if word contains nonvowels
Dim remainder As String = ""
Do Until word = ""
remainder += word(0)
word = word.Remove(0, 1)
'if nonvowel is found
If word.ToLower Like "[aeiouy]* " Then
txtConvertedword.Text = remainder & "-" & remainder & "-ay"
Exit Sub
End If
Loop
Call Convert_To_Pig(remainder)
End Sub