Question

>> to-string pick [abc/def] 1
== "abcdef"
>>

How can I get "abc/def" instead ?

Was it helpful?

Solution

mold pick [abc/def] 1
 == "abc/def"

Or:

form pick [abc/def] 1
=="abc/def"

OTHER TIPS

Using string, which is delimited by {}, you can then use the ^(xx) format to insert an ASCII character by hex code.

Example:

>> to-string pick [{abc^(2F)def}] 1
== "abc/def""
>>

Use the ASCII table here if you need more codes.
For more information on REBOL strings see this link.

The to- family of functions were changed in Rebol 3, and your code now provides the string you want. OTOH, form works in 2 and 3.

Are you using pick [abc/def] 1 because you wanted the literal path abc/def (and not have the interpreter try to pick def out of abc)? You can use quote to get that effect more simply:

>> form quote abc/def
== "abc/def"

And then there's the shorthand:

>> form 'abc/def
== "abc/def"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top