Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PIG LATIn

Status
Not open for further replies.

xeo123

Programmer
Apr 13, 2006
4
US
HEY GUYZ CAN YOU HELP ME ON THIS
using an inputbox to get the words and termintates with "XXXX"
rules.
1.first vowel of the original word becomes the start of the new word
any preceding letters are shifted to the end followed by AY
ex. word = FLYING
newword=INGFLYAY
2 a word begins with a vowel is translated by simply attaching WAY to the end
word=APPLE
newword=APPLEWAY
using only mid,left,right,logical(or) etc
 
So no regular expressions? hmmm, maybe a for loop like this:

for i = 1 to len(word)
'get uppercase letter at position i
char = ucase(mid(word, i, 1))

'is it a vowel?
if (char = "A") or _
(char = "E") or _
(char = "I") or _
(char = "O") or _
(char = "U") then

'yes, is it the 1st character?
if i = 1 then
'yes, add WAY and exit loop
word = word & "WAY"
exit for
else
'no, remix it and exit loop
word = mid(word, i) & left(word, i - 1) & "AY"
exit for
end if
end if
next


This isnt homework, right?
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top