Book Image

LiveCode Mobile Development Cookbook

By : Dr. Edward Lavieri
Book Image

LiveCode Mobile Development Cookbook

By: Dr. Edward Lavieri

Overview of this book

Table of Contents (17 chapters)
LiveCode Mobile Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Translating text into Pig Latin


In this recipe, you will learn how to translate standard text into Pig Latin. To accomplish this task, you will ask the user for an English word, determine if the word starts with a vowel or not, and then convert the word to Pig Latin in two steps.

Note

Pig Latin words are formed by modifying English words. The first consonant of an English word is moved to the end of the word and "ay" is added as a suffix. If the word begins with a vowel, then it is modified only by adding the suffix "ay." So, "LiveCode" would become "iveCodelay".

How to do it...

While you might never need to use Pig Latin in the mobile apps you develop, this recipe shows some of LiveCode's powerful text controls:

  1. Create a new main stack in LiveCode.

  2. Create a button with the name pigLatin.

  3. Add the following code to the pigLatin button:

    on mouseUp
      local englishWord, pigLatinWord, tLetter
      
      ask question "Enter an English word" titled "Word Entry"
      put it into englishWord
      put englishWord into...