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?

Without your code, there isn't much to say. Post it here.

sorry was looking for edit couldnt find it here is code.

        '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

Hello,

You would need to build a special test for consonant pairs (ch,gl,gh,fl sh,th,st,sp kn,sn,sl,pl,wh, and any others you can think of...) like you did for the vowels. You will need to put it before the single consonant process to eliminate them before you get to that part. Also you did not do anything for the numeric word and you will need to test for that.

i fixed it. Thanks all for the help though

 Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click
        'declare variables

        Dim strOriginalWord As String
        Dim strPigLatin As String



        'assign user input to variable
        strOriginalWord = txtWordenter.Text.Trim

        ' make sure the user enters a word

        If strOriginalWord = "" Then

            MessageBox.Show("Please Enter a Word")

        End If

        If strOriginalWord <> Nothing Then

        End If


        '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, 2) & "-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


    ' make sure the guest wants to leave the app
    Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        Dim dlgButton As DialogResult
        dlgButton = MessageBox.Show("Do You want To exit ? ", "Cable Direct", MessageBoxButtons.YesNo)


        If dlgButton = Windows.Forms.DialogResult.No Then
            e.Cancel = True


        End If
    End Sub




    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub


    'Clears labels when words change
    Private Sub ClearLabels(sender As Object, e As EventArgs) Handles txtWordenter.TextChanged
        lblConvertedword.Text = String.Empty
    End Sub

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
        ' clears the words enetered
        txtWordenter.Text = String.Empty
    End Sub

    Private Sub WordConvert_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class

If your question has been answered please mark it as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.