[REBOL] Re: Textlist items selection
From: deadzaphod:flyingparty at: 11-Sep-2001 4:59
Well, this won't solve everything, but here's a function I wrote a week or
so ago to deal with this problem. The first function changes a block so
that all values are recognized as differnent by text-list, the second gives
the index in the list of a value, so if you need it you can look up the
original version of the strings (without the whitespace added to the end).
; for use with VID text-list data
make-unique-list: func [
"Makes duplicate values discernable in a list of strings"
list /local n out
] [
out: make block! length? list
repeat n length? list [
either find skip list n pick list n [
insert tail out (head insert/dup tail (trim/tail copy pick list n)
n)
][
insert tail out copy pick list n
]
]
out
]
index-of-value: func [ unique-list value ] [ index? any [ find unique-list
value return none ] ]