|
-
April 11th, 2015, 07:49 PM
#1
can someone help me with my pig latin converter?
I have been working on a pig latin converter. If a letter starts with a vowel or number it should end with way if it begins with a consonant it should revert the letters so the first one begins with aeiouy like chair should be airchay. Everything in my program works but can someone tell me why im getting aircay instead of airchay?
'determine if the word starts with a vowel, consonant, or numeric
'display original word with vowel as piglatin word add "-way" to end of word
'consonants to end of word with 'ay" added to end of consonants
'if words are numeric add "-way" to end of numeric expression
If strOriginalWord.Substring(0, 1).ToUpper() Like "[AEIOU]" Then
strPigLatin = strOriginalWord & "-way"
lblConvertedword.Text = strPigLatin
ElseIf strOriginalWord.Substring(0, 1) Like "[0-9]" Then
strPigLatin = strOriginalWord & "-way"
lblConvertedword.Text = strPigLatin
Else
strPigLatin = Mid(strOriginalWord, 3) & Mid(strOriginalWord, 1, 1) & "-ay"
lblConvertedword.Text = strPigLatin
End If
txtWordenter.Focus()
End Sub
Private Sub ConvertPigLatin(ByVal wordConvert As String, ByRef pigLatinWord As String)
If wordConvert.Substring(0, 1).ToUpper Like "[AEIOU]" Then
pigLatinWord = wordConvert & "way"
End If
Dim strTemp As String = ""
If wordConvert.Substring(0, 1).ToUpper Like "[!AEIOU]" Then
Do While wordConvert <> ""
strTemp = strTemp + wordConvert(0)
wordConvert = wordConvert.Remove(0, 1)
If wordConvert.ToUpper Like "[AEIOUY]*" Then
pigLatinWord = wordConvert & strTemp & "ay"
Exit Sub
End If
Loop
End If
If strTemp.ToUpper Like "*[!AEIOUY]*" Then
pigLatinWord = strTemp & "way"""
End If
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|