Search code examples
rebolrebol3

Converting an issue to a string


In Rebol 2 you can convert an issue to a string with a simple to string! For example,

>> to string! #12345-12345  
== "12345-12345"

In Rebol 3 the behaviour is different. For example,

>> to string! #12345-12345  
== "#12345-12345"

My current solution is,

remove to string! #12345-12345  
== "12345-12345"

But I don't like this solution as it makes an assumption of what the string representation will be. Is there a better way of retrieving the value from an issue?


Solution

  • In R3, the issue! type has been changed to a word subtype (i.e. a member of the any-word! typeset):

    >> any-word? #12345-12345
    == true
    

    So your question can be rephrased as: how to obtain the canonical spelling of any word type?

    The approach I'd like to suggest is to convert to a plain word! first, and then convert that to a string:

    >> form to word! #12345-12345
    == "12345-12345"