Sunday, May 27, 2012

Remove the vowels

Here is a possible solution:
    when green flag clicked
        ask "Enter the sentence" and wait
        set "OrigSentence" to (answer)
        set "i" to "1"
        set "WithoutVowels" to ""
        repeat (length of (OrigSentence))  
            if (not (((letter (i) of (OrigSentence)) = "a") or ((((letter (i) of (OrigSentence)) = "e") or ((letter (i) of (OrigSentence)) = "i")) or (((letter (i) of (OrigSentence)) = "u") or ((letter (i) of (OrigSentence)) = "o"))))) 
                set "WithoutVowels" to (join (WithoutVowels) (letter (i) of (OrigSentence)))
            change "i" by 1
        say (join (join (OrigSentence) " without vowels is ") (WithoutVowels)) for 6 secs

1 comment: