[TIB] Re: Character Substitution?
[Prev][Next][Index][Thread]
[TIB] Re: Character Substitution?
On Thu, 3 May 2001, ffolkes wrote:
>
> Hello-
>
> I'd like to make a program to substitute characters from a string, i.e.:
>
> g = t
> o = r
> a = b
> t = v
> s = n
>
> String: "goats"
> Output of Program: "trbvn"
>
> *Roughly*, how would I go about this? I am familiar to an extent with
> TI-BASIC. Thanks.
>
> TM
>
>
>
Hi,
here's a program for a ti-92 to do that
Just enter the string and hit esc
""->fstring
newMat(26,2)->mat
"g"->mat[1,1]
"t"->mat[1,2] g = t
"o"->mat[2,1]
"r"->mat[2,2] o = r
...
Lbl begin
While k=0
getKey()->k
EndWhile
If k = 264 Esc was hit
Disp String
Goto end
EndIf
char(k)->c Turn Value from getkey to a character
0->k
0->done
0->i
While done=0 Search matrix till it finds the correct character
If c=mat[i,1] Then
String&mat[i,2]->String
1->done
EndIf
i+1->i
EndWhile
Goto begin
Lbl end
References: