Author Topic: Str Q  (Read 3364 times)

0 Members and 1 Guest are viewing this topic.

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Str Q
« on: May 30, 2012, 02:02:45 pm »
Is it possible to put "a" into a string after a certain length. Like replacement?

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Str Q
« Reply #1 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. ???
« Last Edit: May 30, 2012, 02:11:48 pm by parser padwan »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Str Q
« Reply #2 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)
« Last Edit: May 30, 2012, 02:33:58 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Str Q
« Reply #3 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

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Re: Str Q (another)
« Reply #4 on: May 31, 2012, 01:02:06 am »
Is it possible to have a str wrap on the same line like:
.....................
.                    .
.DEF        ABC .
.                    .
.....................

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Str Q
« Reply #5 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.)
« Last Edit: May 31, 2012, 01:23:07 am by Deep Thought »




Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Re: Str Q
« Reply #6 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.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Str Q
« Reply #7 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.