Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Piglatin
#17
It's a silly but popular english language game. Words beginning with vowels have "WAY" attached to it ('igloo' becomes 'igloo-way'). If a word has constants at the beginning, they're move to the end with "AY" at the end. ('string' becomes ing-stray). Words beginning with QU are done like this. ('quest' becomes 'est-quay')

It's worthless talk, but became very popular in the US among both kids and adults.

Here's my last try. This one parses, but periods, question marks, etc, are not handled.

Code:
DECLARE FUNCTION Piggy$ (In$)

PRINT Piggy$("what is pig latin that is the question")
PRINT Piggy$("hello my name is dave and i'm a pig")
PRINT
INPUT "What do you say, pig"; A$
PRINT Piggy$(A$)

FUNCTION Piggy$ (In$)

Out$ = ""

DO UNTIL w >= LEN(In$)
    '=== Parse a word...
    temp$ = ""
    WHILE MID$(In$, w + 1, 1) <> " " AND MID$(In$, w + 1, 1) <> ""
        temp$ = temp$ + MID$(In$, w + 1, 1)
        w = w + 1
    WEND
    '====== piggy it ====
    FOR x% = 1 TO LEN(temp$)
      SELECT CASE UCASE$(MID$(temp$, x%, 1))
        CASE IS = "A", "E", "I", "O", "U", "Y": EXIT FOR
      END SELECT
    NEXT
    '=== If vowel first...
    IF x% = 1 THEN
       Out$ = Out$ + temp$ + "-way "
    '=== If starts with "qu"...
    ELSEIF UCASE$(LEFT$(temp$, 2)) = "QU" THEN
       Out$ = Out$ + RIGHT$(temp$, LEN(temp$) - 2)
       Out$ = Out$ + "-" + LEFT$(temp$, 2) + "ay "
    '=== else...
    ELSE
       L$ = LEFT$(temp$, x% - 1)
       R$ = MID$(temp$, x%, LEN(temp$))
       Out$ = Out$ + R$ + "-" + L$ + "ay "
    END IF
    '====================
    w = w + 1
LOOP

Piggy$ = Out$

END FUNCTION

- Dav
Reply


Messages In This Thread
Piglatin - by whitetiger0990 - 05-23-2003, 05:20 AM
Piglatin - by seph - 05-23-2003, 05:39 AM
Piglatin - by whitetiger0990 - 05-23-2003, 06:16 AM
Piglatin - by seph - 05-23-2003, 06:19 AM
Piglatin - by Ninkazu - 05-23-2003, 06:39 AM
Piglatin - by whitetiger0990 - 05-23-2003, 07:24 AM
Piglatin - by Dav - 05-23-2003, 07:25 AM
Piglatin - by DrV - 05-23-2003, 07:27 AM
Piglatin - by whitetiger0990 - 05-23-2003, 07:36 AM
Piglatin - by Dav - 05-23-2003, 07:42 AM
Piglatin - by Ninkazu - 05-23-2003, 07:55 AM
Piglatin - by DrV - 05-23-2003, 08:03 AM
Piglatin - by Ninkazu - 05-23-2003, 08:09 AM
Piglatin - by Dav - 05-23-2003, 08:09 AM
Piglatin - by Hexadecimal Disaster - 05-23-2003, 10:41 AM
Piglatin - by Neo - 05-23-2003, 06:37 PM
Piglatin - by Dav - 05-23-2003, 07:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)