Author Topic: Help with altering the end of a String.  (Read 684 times)

I need to alter "Username: Hello world! <random data at end>". I know this is quite simple but it means a lot to me.

The problem is the index changes because the string length alters making it difficult to remove the ending of the string.

One time it could be

"Username: I like food. Hello world! <random data at end>" and other times

"Username: Hello.<random data at end>"

What would be the best way to deal with this? A while loop going through each word to check if it matches a criteria and then somehow cutting of the end of the sentence that is not needed?

Any help is appreciated since I've been searching the blockland forums/torque forums for an answer.


Would the data at the end of the string always be one word?

Tell us what sort of data
Also, will the beginning of the sentence be the same always?

Ok an example of this is:

"Username: How did you hear about Username?    </div>^^<form method="get" action="index.php">",0, -1"

This is directly from the script. I realize the end also changes (the numbers). The message the user says also changes.

I believe I'm going to have to modify a few php scripts to get this running. I am clueless with setting up GET http requests.

Tell us what sort of data
Also, will the beginning of the sentence be the same always?
Yes, I'm using strstr to shorten it down so that it starts with "username".

You're still not being very clear. Give us a better example, and explaining the purpose of this mod might help as well

Don't worry about idea stealing or anything, we're a civilized bunch here in coding help

Yikes ok where to start.

I'm running an IIS (personal windows web-server/service) configured with CGI PHP which is also configured directly to a community developer edition of a MySQL server using custom php scripts. I have all the php scripts operational. I am communicating to my third party service using torque script which communicates directly with php scripts through tcpobjects however they are configured to provide all the necessary http data. Currently I want to keep as much of the details as closed as possible not because I don't want people to copy but I want it to be a surprise.

Now I believe I need to work in a new direction. Perhaps I should try to work out how to use GET HTTP requests to gain my data. I'll investigate a bit deeper into one of the index pages for some clues to a GET request


If your "random data" always starts with </div> like posts would, you can do:

%fixedData = getSubStr(%rawData, 0, strPos(%rawData, "</div>"));

If you're truly running an IIS then you should be able to modify the PHP code to put a tag on each post to signify where the post ends. Or you can fix your PHP code to output those tags on a different line, thus resolving the problem completely for the data won't be there in the first place. I don't see why it doesn't do this.
« Last Edit: July 22, 2012, 09:06:38 AM by Slicks555 »

If your "random data" always starts with </div> like posts would, you can do:

%fixedData = getSubStr(%rawData, 0, strPos(%rawData, "</div>"));

If you're truly running an IIS then you should be able to modify the PHP code to put a tag on each post to signify where the post ends. Or you can fix your PHP code to output those tags on a different line, thus resolving the problem completely for the data won't be there in the first place. I don't see why it doesn't do this.
That's a genuine genius Idea but it will require modding some of the core scripts which I'm trying now.

Edit:

I modified some of the php code to simplify the exchange. It seems I managed to work it out after all.
« Last Edit: July 22, 2012, 12:47:56 PM by aludane »