|
2020-06-21
| ||
| 15:43 | • Closed ticket [a7c1c2c7e5]: lsearch with -all options does not return -1 where n... artifact: 48041000cf user: jan.nijtmans | |
| 15:42 | Clearify documentation regarding [a7c1c2c7e5] check-in: 61a0475861 user: jan.nijtmans tags: core-8-6-branch | |
|
2020-06-20
| ||
| 07:08 | • New ticket [a7c1c2c7e5] lsearch with -all options does not return -1 where no ma... artifact: 71d17fb295 user: zhou | |
lsearch with -all options does not return -1 where no match is found
Closed / Invalida7c1c2c7e56410980eb154b681f0c5958f2f4cd1Created 6 years agoUpdated 6 years ago
Descriptionplain2020-06-20 07:08:43
The document of lsearch command says: This command searches the elements of list to see if one of them matches pattern. If so, the command returns the index of the first matching element (unless the options -all or -inline are specified.) If not, the command returns -1. The option arguments indicates how the elements of the list are to be matched against pattern and must have one of the values below: But if you specify the -all option and there is no matches found, the lsearch command returns an empty string instead of -1.
Referenced by1
61a0475861Clearify documentation regarding [a7c1c2c7e5] check-in2020-06-21 15:42:18
jan.nijtmanswiki2020-06-21 15:43:18
Maybe surprising, but - apparently - this is exactly as expected. The documentation of "-all" says: "Changes the result to be the list of all matching indices". Since there is no match, the list of all matching indices is empty and that's what's returned.
The documentation you state also contains "(unless the options -all or -inline are specified.)". So, the command only returns -1 for no match is neither -all nor -inline is specified. So - my conclusion - is: This is as originally designed, and it's as it should be. So, marking this one as "Invalid", since it works as designed.
However, I adapted the documentation a little bit, clarify this confusion.
Log in (anonymous is fine) to add a comment.