Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Can we please have a GetStringToken3?

Author
Message
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 10th Jun 2016 16:54 Edited at: 10th Jun 2016 16:54
I find GetStringToken to be less than useful compared to other languages, can we please just have a version that actually splits on the the entire string like most other languages? Similar to the way PHP explode works maybe?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jun 2016 17:14
means u want that it return a string array?

AGK (Steam) V2.0.19 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 10th Jun 2016 17:56 Edited at: 10th Jun 2016 18:00
Hi Marcus, and thank you for your reply.

In PHP (and most other languages I have used) I can split a string into an array by feeding it a string which is not treated as a series of delimiters. For example...



In the AppGameKit example you posted, this will return

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jun 2016 20:20
ahh, that happens because agk use only the first char from the delimiter string and you will split by a string, thats something for paul.
me tested with a comma but also expect it works with a string name as delimiter.
as workaround maybe use ReplaceString and make your delipiter string into a unique char to split it by.


AGK (Steam) V2.0.19 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 10th Jun 2016 23:03 Edited at: 10th Jun 2016 23:04
I just knocked this up... It's probably not all that fast, but does what you need (I think):



I hope it is useful to you.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 11th Jun 2016 01:45
Hi CJB, and many thanks for your help and going to the trouble of creating that code. It does work, thank you

It is just a pity that as developers we keep having to create lines of code that other languages achieve with just one or two.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 11th Jun 2016 09:38 Edited at: 11th Jun 2016 09:38
GetStringToken2() could be changed to allow more than one character as a delimiter.

Login to post a reply

Server time is: 2024-09-29 15:29:24
Your offset time is: 2024-09-29 15:29:24