LonkeroAdministrator
(KiX Master Guru)
2005-08-26 01:58 PM
aScan() enhancement - return all matches

decided to do new thread to avoid confusion.
ascan, even though is powerfull tool, needs to be called multiple times in most of the uses because there are more than one matches and all need to be found.

I would thus suggest that aScan() would be enhanced to return optionally array of the results.

so:
$array="some","words","and","some","more"
$matches = ascan($array,"some",...,1) ;last argument, return all occurences
for each $match in $matches
$match ","
next

would result in "0,3"


Ruud van Velsen
(Hey THIS is FUN)
2005-08-29 06:31 PM
Re: aScan() enhancement - return all matches

Ok, I understand what you are looking for.

I'll put this on the todo-list. Can't promise this will make it into 4.51, but I'll try.

Ruud


Ruud van Velsen
(Hey THIS is FUN)
2005-12-22 10:44 AM
Re: aScan() enhancement - return all matches

In short: this is in BETA 1 of 4.52.

Ruud


LonkeroAdministrator
(KiX Master Guru)
2005-12-22 12:08 PM
Re: aScan() enhancement - return all matches

yehaa.
thanks.


masken
(MM club member)
2005-12-23 11:49 AM
Re: aScan() enhancement - return all matches

Does this include the option of partial matches?

Ie an ascan for "my" will optionally return a match on the array element "thisismystring" ?


LonkeroAdministrator
(KiX Master Guru)
2005-12-23 01:12 PM
Re: aScan() enhancement - return all matches

masken, no.
it was included already in 4.51


AllenAdministrator
(KiX Supporter)
2005-12-23 02:45 PM
Re: aScan() enhancement - return all matches

Quote:


4) Added an option to AScan to return all matching elements.

The 'Mode' parameter of AScan now takes a bitpattern as input with the
following possible values:

bit 0 0 = search for exact match (default) 1 - do an instr() scan
bit 1 0 = return first matching element 1 - return all elements

Examples:

AScan( $Array, $String,,, 0) ; scan for exact match and return 1st hit
AScan( $Array, $String,,, 1) ; use InStr() and return 1st hit
AScan( $Array, $String,,, 2) ; scan for exact match and return all hits
AScan( $Array, $String,,, 3) ; use InStr() and return all hits






LonkeroAdministrator
(KiX Master Guru)
2005-12-23 02:59 PM
Re: aScan() enhancement - return all matches

nice nice.
just like I wished it.
nice nice.