Translates text into piglatin.. $piglatin(Text) ... See the code for example...
; $piglatin(text)
; Translates text into piglatin.
; Usage: $piglatin(My cat got expelled) would return
; Ymay Atcay Otgay Expelleday
; $piglatin(dog eat dog world) would return
; Ogday Eatay Ogday Orldway
alias piglatin {
var %i = 1, %x = $numtok($1-,32)
while (%i <= %x) {
var %w = $gettok($1-,%i,32), %nword, %f
if ($lower($left(%w,1)) isletter aeiou) { var %output = %output $+(%w,way) }
else {
var %n = 1
while (%n <= $len(%w)) {
var %c = $lower($mid(%w,%n,1))
if (%c isletter aeiou) {
var %nword = $+($right(%w,- $+ $calc(%n - 1)),$left(%w,$calc(%n - 1)),ay), %output = %output $upper($left(%nword,1)) $+ $lower($right(%nword,-1))
var %f = 1
break
}
else {
if ((!$count(%w,a) && !$count(%w,e) && !$count(%w,i) && !$count(%w,o) && !$count(%w,u)) && %c == y) {
var %nword = $+($right(%w,- $+ $calc(%n - 1)),$left(%w,$calc(%n - 1)),ay), %output = %output $upper($left(%nword,1)) $+ $lower($right(%nword,-1))
var %f = 1
break
}
}
inc %n
}
if (!%f) { var %output = %output %w }
}
inc %i
}
return %output
}
In response to Sasuke...
My exmple was to prove that this can be done for any word the user inputs.. instead of having a huge list of words, which is alot, and just constantly doing $replace on them..