your close...
When you use the "split" command it populates the string into the "Wordlist" array.
strInput = "Hello this is a test"
WordList = Split(strInput, " ") - seperates via spaces
What you have now:
Wordlist(0) = "Hello"
Wordlist(1) = "this"
Wordlist(2) = "is"
Wordlist(3) = "a"
Wordlist(4) = "test"
[code]
'Since we are seperating, we need something to put it back together with...
Dim strTotalOutput as string
'LBound is the lower array number of Wordlist
'UBound is the upper arra number of Wordlist
For i = LBound(WordList) To UBound(WordList)
'Move this down to here... and we are going through each word...
str1stChar = Wordlist(i).Substring(0, 1)
Select Case str1stChar.ToUpper
Case "A", "E", "I", "O", "U"
strOutput = (strInput & "WAY")
Case Else
strOutput = (Wordlist(i).Substring(1) & str1stChar & "AY")
End Select
'Now since we have seperated each word
'we have to put it back together... and put spaces back between...
strTotalOutput = strTotalOutput + strOutput +" "
'Loop through each word...
next i
MessageBox.Show(strTotalOutput, "Pig Latin")
Now, this is not the most efficient way of doing it, but that will come in time.
:-)
your close...
When you use the "split" command it populates the string into the "Wordlist" array.
strInput = "Hello this is a test"
WordList = Split(strInput, " ") - seperates via spaces
What you have now:
Wordlist(0) = "Hello"
Wordlist(1) = "this"
Wordlist(2) = "is"
Wordlist(3) = "a"
Wordlist(4) = "test"
CODE
'Since we are seperating, we need something to put it back together with...
Dim strTotalOutput as string
'LBound is the lower array number of Wordlist
'UBound is the upper arra number of Wordlist
For i = LBound(WordList) To UBound(WordList)
'Move this down to here... and we are going through each word...
str1stChar = Wordlist(i).Substring(0, 1)
Select Case str1stChar.ToUpper
Case "A", "E", "I", "O", "U"
strOutput = (strInput & "WAY")
Case Else
strOutput = (Wordlist(i).Substring(1) & str1stChar & "AY")
End Select
'Now since we have seperated each word
'we have to put it back together... and put spaces back between...
strTotalOutput = strTotalOutput + strOutput +" "
'Loop through each word...
next i
MessageBox.Show(strTotalOutput, "Pig Latin")
Now, this is not the most efficient way of doing it, but that will come in time.
:-)