Docs: Instr() multiple matches

Archives Forums/Blitz3D Bug Reports/Docs: Instr() multiple matches

Spacechimp(Posted 2008) [#1]
I apologize if this has already been posted somewhere.


I would like to propose a small change to the bb manual.

It seems to me (and I may be wrong) that in the case of multiple matches that Instr() will find the first match to the left and return the position.

Until i tested it, I wasn't quite sure what would happen in the circumstances of multiple matches. Can the online docs be changed to reflect this?

Thank you


GfK(Posted 2008) [#2]
The docs for Instr() clearly state that you can provide an 'offset' parameter to specify where you want to begin your search, if not the start of the string. This parameter is there so that you can search for multiple occurences yourself.

It doesn't really qualify as a bug - its just the way it works.


Ross C(Posted 2008) [#3]
Actually it's quite handy, as, as gfk says, you can start your search from the position of the first occured match. That way you have more control over it.


Yan(Posted 2008) [#4]
I'd have to agree that, for the sake of clarity, the docs should really read something like...

The command returns the location (number of characters from the left) of the first occurrence of the string you are looking for.



This doesn't really belong here thought as you can add comments and amendments to the online docs yourself.


Spacechimp(Posted 2008) [#5]
Oh, I am very pleased with the way it works. It makes perfect sense to me. I am just suggesting that part be added to the docs.

Ian, thanks for pointing that out.