Re: TIB: hellooo?


[Prev][Next][Index][Thread]

Re: TIB: hellooo?




>On a basic not, is it possible to do make a string and change the letter of
>one of the letters in that string?
>
>example:
>
>"abc"->a
>sub(a,2,1->b
>"l"->sub(a,2,1
>
>so that the letter b would be 'b'.  Then, could you change that to 'l' for
>example, so you would have "alc" as a?  I need to know for a text
scrambler.
>

On TI-92 Plus:
Scrambles all lower-case a-z string into all-uppercase Z-A and vice-versa:

()
Prgm
Local  a,length,c,strng,ul
0»length
0»c
1»ul
""»strng
Dialog
 Request  "String to scramble",strng
 DropDown  "Scramble",{"upper to lower","lower to upper"},ul
EndDlog
If  ok=0: Goto  end
If ul=1 Then:65»a1:91»a2:EndIf
If ul=2 Then:97»a1:123»a2:EndIf
dim(strng)»length
Loop
inString(strng,char(a1))»c
If  c>0
left(strng,c-1)&char(abs(a1-187))&right(strng,length-c)»strng
If  c=0
a1+1»a1
If  a1=a2
Goto  end
EndLoop
Lbl  end
Disp  strng
EndPrgm

Keep in mind that the string must be ALL upper or ALL lower.  No MixEd CaSE
or it won't work.  I didn't program it to save the encoded string but hey, I
have to leave you some fun, don't I?  (I wouldn't want to be accused of
stealing your idea  j/k).  No competition here.  You can have this code.
Make it better.  Improve it.  It's all yours.  If you don't know what the
commands do because it's TI-92 Plus basic, ask me, I'll try to explain in
more detail.