... nope ...

by AlGoreIthm (no login)

Simple table-driven method is always my preference - SELECT CASE is too cumbersome for my taste, never use it.

DECLARE FUNCTION changeperson$ (tochange$)

INPUT tochange$

IF tochange$ <> "" THEN
i$ = changeperson$(tochange$)
PRINT i$
END IF


FUNCTION changeperson$ (tochange$)

DIM s$(9)

s$(1) = "i you"
s$(2) = "my your"
s$(3) = "mine yours"
s$(4) = "me you"
s$(5) = "myself yourself"
s$(6) = "you me"
s$(7) = "yours mine"
s$(8) = "your my"
s$(9) = "yourself myself"

tochange$ = LCASE$(LTRIM$(RTRIM$(tochange$))) + " "

looper% = 1
found% = 0

DO

IF LEFT$(s$(looper%), LEN(tochange$)) = tochange$ THEN found% = looper% ELSE looper% = looper% + 1

LOOP UNTIL found% = looper% OR looper% = 10

IF found% THEN
changed$ = MID$(s$(found%), LEN(tochange$) + 1, LEN(s$(found%)) - LEN(tochange$))
PRINT changed$
ELSE PRINT "NOT FOUND in table"
END IF

END FUNCTION

Posted on Jul 19, 2012, 7:29 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
alternativeAlGoreIthm on Jul 19
 Re: alternative on Jul 20
  YesAlGoreIthm on Jul 20
   Re: Yes on Jul 20
   program not undestood. on Jul 21
Please ... on Jul 21
 Re: Please ... on Jul 21
 Very wellAlGoreIthm on Jul 21