replace token?

For questions about using Classic.

Post » Mon Sep 12, 2011 4:05 pm

Seems you can only access tokens in text, but you can't change them. For instance I might want to change the 5th token in a string "0,3,1,6,34,21,0,0,etc."

Is there a way to do it?
B
155
S
76
G
21
Posts: 1,797
Reputation: 23,475

Post » Mon Sep 12, 2011 5:38 pm

Maybe pull all the values into an array, change the one you'd like and store them back in the string.
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
129
S
43
G
18
Posts: 2,241
Reputation: 20,644

Post » Tue Sep 13, 2011 12:53 am

Thanks I guess thats the only way it can be done.
B
155
S
76
G
21
Posts: 1,797
Reputation: 23,475

Post » Tue Sep 13, 2011 4:17 am

[QUOTE=alspal] Thanks I guess thats the only way it can be done.[/QUOTE]

It's not the only way, if you want to do it in a single action (and have a set amount of tokens in the string), you can use this inefficient method:

Text = GetToken(text, 1, seperator) + ... + "NewItem" + seperator + GetToken(text, 6, seperator) + ...
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
129
S
43
G
18
Posts: 2,241
Reputation: 20,644


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests