REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 20-Jan-2013 Edit History  

REBOL 3 Functions: select

select  series  value  /part  length  /only  /case  /any  /with  wild  /skip  size  /last  /reverse

Finds a value in the series and returns the value or series after it.

Arguments:

series [series! port! map! object! none!]

value [any-type!]

Refinements:

/part - Limits the search to a given length or position

length [number! series! pair!]

/only - Treats a series value as only a single value

/case - Characters are case-sensitive

/any - Enables the * and ? wildcards

/with - Allows custom wildcards

wild [string!] - Specifies alternates for * and ?

/skip - Treat the series as records of fixed size

size [integer!]

/last - Backwards from end of series

/reverse - Backwards from the current position

See also:

find   switch  

Description

Similar to the find function, but returns the next value in the series rather than the position of the match. Returns NONE if search failed.

The /only refinement is evaluated for a block argument and is ignored if the argument is a string.

blk: [red 123 green 456 blue 789]
print select blk 'red
123
weather: [
    "Ukiah"      [clear 78 wind west at 5 MPH]
    "Santa Rosa" [overcast 65 wind north at 10 MPH]
    "Eureka"     [rain 62 wind north at 15 MPH]
]
probe select weather "Eureka"
[rain 62 wind north at 15 MPH]


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin