Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

words-like - Returns a block of words in the object that match the given pattern. (See related posts)

words-like: func [
    "Returns a block of words in the object that match the given pattern."
    object  [object!]
    pattern [word! any-string!]
    ;??? Add an /unbound refinement
][
    pattern: join form pattern "*"
    collect w [
        foreach word next first object [
            if find/match/any form word pattern [w: bind word in object 'self]
        ]
    ]
]

You need to create an account or log in to post comments to this site.


Click here to browse all 4881 code snippets

Related Posts