Gettoken count counts one more?

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Gettoken count counts one more?

Post by Marco »

Code: Select all

echo gettoken("a,b,c,d,e", "count", ","); // 5
But I see only four commas...
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Gettoken count counts one more?

Post by serendipity »

Marco wrote:

Code: Select all

echo gettoken("a,b,c,d,e", "count", ","); // 5
But I see only four commas...
Yes, i was confused too when Don first introduced this, but its to get all 5 tokens; a thru e.
edit: token 1 would be a and token 5 would be e, commas are separators not tokens itself.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Gettoken count counts one more?

Post by Marco »

serendipity wrote:Yes, i was confused too when Don first introduced this, but its to get all 5 tokens; a thru e.
edit: token 1 would be a and tone 5 would be e, commas are separators not tokens itself.
So in this case is a count of tokens and not a count of separators, right? Ok, now makes sense.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Post Reply