Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: Wretchedlout on May 30, 2012, 02:02:45 pm

Title: Str Q
Post by: Wretchedlout on May 30, 2012, 02:02:45 pm
Is it possible to put "a" into a string after a certain length. Like replacement?
Title: Re: Str Q
Post by: parserp on May 30, 2012, 02:11:25 pm
I know that you can get a part of a string by doing sub([string],[starting number of char in string],[number of chars to get])
So sub("12345",3,3) would return "345". But as far as storing something into it, I'm not sure. ???
Title: Re: Str Q
Post by: Hayleia on May 30, 2012, 02:33:06 pm
I think you use sub(before_the_a)+"a"+sub(after_the_a) but I am not sure (with before_the_a and after_the_a legit commands of course, like in Parser padwan's post)
Title: Re: Str Q
Post by: parserp on May 30, 2012, 02:40:57 pm
:D yup, that works.

Code: [Select]
:"123456"->Str1
:sub(str1,1,3)+"A"+sub(Str1,5,2)
that code returns "123A56" :D
Title: Re: Str Q (another)
Post by: Wretchedlout on May 31, 2012, 01:02:06 am
Is it possible to have a str wrap on the same line like:
.....................
.                    .
.DEF        ABC .
.                    .
.....................
Title: Re: Str Q
Post by: Deep Toaster on May 31, 2012, 01:23:01 am
Well, the only commands you have for displaying strings on the home screen are Disp and Output, and neither of them do that. (Disp just cuts the string off and adds an ellipsis at the end, while Output wraps the string to the next line.)
Title: Re: Str Q
Post by: Wretchedlout on May 31, 2012, 01:56:58 am
Ok, because I have this:
Code: [Select]
(129-(16(X-1)+Y)
If length(str1)>Ans
Output 1,1,sub(str1,(Ans+1),(length(str1)-Ans)
Output X,Y, Str1

This code took a while yesterday but I was able to make it wrap to the top.
Although, I would rather like it not wrap to the next line because I am working on block cyphers currently.
Title: Re: Str Q
Post by: Deep Toaster on May 31, 2012, 09:44:32 am
Use another sub( in the last Output( line, as in something like Output(X,Y,sub(Str1,1,Ans.