Page 1 of 1 1
Topic Options
#146468 - 2005-08-26 01:58 PM aScan() enhancement - return all matches
Lonkero Administrator Offline
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
#146469 - 2005-08-29 06:31 PM Re: aScan() enhancement - return all matches
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
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

Top
#146470 - 2005-12-22 10:44 AM Re: aScan() enhancement - return all matches
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
In short: this is in BETA 1 of 4.52.

Ruud

Top
#146471 - 2005-12-22 12:08 PM Re: aScan() enhancement - return all matches
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yehaa.
thanks.
_________________________
!

download KiXnet

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

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Does this include the option of partial matches?

Ie an ascan for "my" will optionally return a match on the array element "thisismystring" ?
_________________________
The tart is out there

Top
#146473 - 2005-12-23 01:12 PM Re: aScan() enhancement - return all matches
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
masken, no.
it was included already in 4.51
_________________________
!

download KiXnet

Top
#146474 - 2005-12-23 02:45 PM Re: aScan() enhancement - return all matches
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
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
#146475 - 2005-12-23 02:59 PM Re: aScan() enhancement - return all matches
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nice nice.
just like I wished it.
nice nice.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.058 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org