Words find - r3n/rebol-wiki GitHub Wiki
Finds a value in a series and returns the series at the start of it. Find is an action value.
- series
- (Type: series port bitset)
- value
- (Type: any-type)
- /part
- Limits the search to a given length or position.
- range
- (Type: number series port)
- /only
- Treats a series value as a single value.
- /case
- Characters are case-sensitive.
- /any
- Enables the * and ? wildcards.
- /with
- Allows custom wildcards.
- wild
- Specifies alternates for * and ? (Type: string)
- /skip
- Treat the series as records of fixed size
- size
- (Type: integer)
- /match
- Performs comparison and returns the tail of the match.
- /tail
- Returns the end of the string.
- /last
- Backwards from end of string.
- /reverse
- Backwards from the current position.
Returns NONE if the value was not found. Otherwise, returns a position in the series where the value was found. Many refinements to this function are available.
/CASE specifies that the search should be case sensitive. Note that using find on a binary string will do a case-insensitive search. You must add the /CASE refinement to make it case sensitive.
/TAIL indicates that the position just past the match should be returned.
The /MATCH refinement can be used to perform a character by character match of the input value to the series. The position just past the match is returned.
Wildcards can be specified with /ANY and case sensitive comparisons can be made with /CASE.
The /ONLY refinement applies to block values and is ignored for strings.
The /LAST refinement causes FIND to search from the TAIL of the series toward the HEAD.
/REVERSE searches backwards from the current position toward the head.
probe find "here and now" "and"
probe find/tail "here and now" "and"
probe find [12:30 123 [email protected]] 123
probe find [1 2 3 4] 5
probe find/match "here and now" "here"
probe find/match "now and here" "here"
probe find [1 2 3 4 3 2 1] 2
probe find/last %file.fred.txt "."
probe find/last [1 2 3 4 3 2 1] 2
probe find/any "here is a string" "s?r"| series | Operations on series, including blocks and strings. |
| string | Operations for string series. |
| select | Finds a value in the series and returns the value or series after it. |
| pick | Returns the value at the specified position in a series. |