04-16-2011, 11:40 PM
(This post was last modified: 04-16-2011, 11:42 PM by AceInfinity.)
(04-16-2011, 11:05 PM)KoBE Wrote: Yea, with out the dash it's almost impossible to know whether you took two characters from the front or just one. Also even with the dash... if you have a word like "work" it would be ork-way... but converting back it would be ork. Because ork translated to pig latin would be ork-way as well. This challenge definitely has some holes in it. But it still helps stimulate your programming/logic skills.
I finally got it working with a function that deals with no vowels like i've seen in online translators. for example, a no vowel text like "vkcd" would be "kcd-vay"
Where the v got moved after the hyphen and before the "ay" because it was just the first letter. If no vowels are found, my application will just take the first letter as shown, and do the same thing with it. I added onto your method for doing this as:
Definining noVowels:
Code:
Dim noVowels As String
Making the function for that string:
Code:
noVowels = strWord.Substring(1, 1)
strSplit = strWord.Substring(0, 1).ToLower
strResult = strWord.Substring(1, strWord.Length - 1) & "-" & strSplit & "ay"
Return strResult
Where I had assigned "i" the value of 1
The method for coding my translator was pretty much very similar to yours, where I had defined a string array for each letter (Vowels) as a,e,i,o,u, and added y. Then made the rules for appending and removing certain letters in a loop that scans all words in the input