|
Pages: [1]
|
 |
|
Author
|
Topic: select and wildcards (Read 285 times)
|
|
fhein
|
Could someone please give an example of how to use select/any? It didn't work the way I thought it would
|
|
|
|
|
Logged
|
|
|
|
|
CarlRead
|
Select returns the value after the match, thus... >> str: "abc123def456" == "abc123def456" >> select str "123" == #"d" >> select/any str "12?" == #"d" >> select/any str "c*3" == #"d" If that doesn't solve your problem, describe more fully the type of results you want/expect.
|
|
|
|
|
Logged
|
- Carl Read
|
|
|
|
Gabriele
|
/ANY doesn't work with blocks, if that's what you were after. It only works for strings.
|
|
|
|
|
Logged
|
|
|
|
|
fhein
|
Yeah, I was trying to use it on a bunch of blocks. Thanks for the example too!
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
For blocks, you could use something like: select-any: func [block string] [ foreach [key value] block [ if find/any key string [return :value] ] ] Example: >> select-any ["abc" 1 "def" 2] "a?c" == 1 >> select-any ["abc" 1 "def" 2] "d*" == 2
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |