Suppose i had a the string:


Code:

"<title>hello</title>;->Str1


and i wrote a program to run through it and after it got to certain parts of the string to overwrite it with spaces. How could i do that?
If X is the location of the character to replace:


Code:

If X=1:'[space]'+sub(Str1,2,length(Str1)-1-->Str1
If X>1 and X<length(Str1:sub(Str1,1,X-1)+'[space]'+sub(Str1,X+1,length(Str1)-X-->Str1
If X=length(Str1:sub(Str1,1,length(Str1)-1)+"[space]-->Str1
thanks. now i can start on my completely useless program.
Here's a smaller version:

Code:
:" "+Str1+"
:sub(Ans,1,X)+" "+sub(Ans,X+2,length(Ans)-X-1
:sub(Ans,2,length(Ans)-2->Str1
calc84maniac wrote:
Here's a smaller version:

Code:
:" "+Str1+"
:sub(Ans,1,X)+" "+sub(Ans,X+2,length(Ans)-X-1
:sub(Ans,2,length(Ans)-2->Str1


and if you want to replace with a certain phrase, just change the " " to str2 or whatever its in.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement