#146468 - 2005-08-26 01:58 PM
aScan() enhancement - return all matches
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
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"
_________________________
!download KiXnet
|
Top
|
|
|
|
#146474 - 2005-12-23 02:45 PM
Re: aScan() enhancement - return all matches
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
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
|
Top
|
|
|
|
Moderator: Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 514 anonymous users online.
|
|
|