Game Development Community

String handling?

by Sam3d · in Torque Game Builder · 06/04/2006 (5:55 pm) · 4 replies

I can use HTTP object to pull in a 1k txt file from the server.

But I'm unsure as to how to parse the contents.

Content example: 12,May-06,45,April-06 etc.

Wish I could 'explode' on the commas...

Any suggestions on how to create an array from such a string?

#1
06/04/2006 (10:44 pm)
If you have control over the server, seperate your content with spaces then you can use getWord with getWordCount to build an iterator? Perhaps.. otherwise you would need to build somthing that looks for substrings and positions,
#2
06/05/2006 (9:28 am)
I can separate with spaces. And use getWord and getWordCount. Thanks.

I think I could also use firstWord and restWords to iterate thru a string separated by spaces.

How do people handle highscore strings? TCPobject and readline?
#3
06/07/2006 (10:58 am)
There is also , getFields for comma seperated strings, so you might not need to use spaces.
#4
06/07/2006 (1:36 pm)
@Sam, in the game demos with TGB, the devs just use a FOR loop and getWord() each index of your string. It's fast enough. Not sure about TCPObject I haven't used it that much.