Here is my code so far
As you can see, to find words that start with a consonant I kinda cheated so my teacher wouldn't notice, but he did!
I was getting fed up with this whole exercise so I decided to make it work for the word "chair" only.
You can probably tell that by looking at the code.
Well, I need to fix it, and I have no idea how!
I have reviewed the chapter multiple times, and he is the kind of teacher that doesn't help you at all.
Can someone help me get this working for any word?
Here are the examples for pig latin
Ant = ant-way
56 = 56-way
Chair = air-chAY (the Ay is the added part)
So what I was thinking was maybe I need to have it split once it finds the first vowel in the word, seperate that part, add a - and then the -ay ending? Can someone maybe code an example so I can figure this out??
- Ben
Dim strInput As String = ""
Dim str1stCharacter As String = ""
Dim strOutput As String = ""
Dim intStringLength As Integer = 0
strInput = Me.TextBox1.Text
str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1)
Select Case str1stCharacter.ToUpper()
Case "A", "E", "I", "O", "U", "Y", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
strOutput = strInput & "-WAY"
Case Else
intStringLength = Len(strInput)
strOutput = Microsoft.VisualBasic.Right(strInput, 3) _
& "-" & Microsoft.VisualBasic.Left(strInput, 2) & "ay"
End Select
Me.Label1.Text = "The Pig Latin Translation of " & strInput & " is " & strOutput & "."
End Sub
As you can see, to find words that start with a consonant I kinda cheated so my teacher wouldn't notice, but he did!
I was getting fed up with this whole exercise so I decided to make it work for the word "chair" only.
You can probably tell that by looking at the code.
Well, I need to fix it, and I have no idea how!
I have reviewed the chapter multiple times, and he is the kind of teacher that doesn't help you at all.
Can someone help me get this working for any word?
Here are the examples for pig latin
Ant = ant-way
56 = 56-way
Chair = air-chAY (the Ay is the added part)
So what I was thinking was maybe I need to have it split once it finds the first vowel in the word, seperate that part, add a - and then the -ay ending? Can someone maybe code an example so I can figure this out??
- Ben