On 11-Feb-02, [EMAIL PROTECTED] wrote:

> sorry, I'm not used to the harder stuff like
> parsing, yadda, yadda, yadda.

> What I'm looking for is a function/native that
> will change a word into a block of characters,
> for example:

> tochar "Hello"

> Word: [
>       H
>       e
>       l
>       l
>       o
> ]

Hi Daniel,

I notice Brett has just posted similar stuff to the following, but
this is what I came up with anyway...


This function should do what you want...

to-chars: func [str /local word][
    word: copy []
    forall str [append word str/1]
    word
]

>> to-chars "hello"
== [#"h" #"e" #"l" #"l" #"o"]

>> to-chars "goodbye"
== [#"g" #"o" #"o" #"d" #"b" #"y" #"e"]

However, depending on what you're doing, you may be able to get the
results you want without needing to convert a string to a block, as a
string is already a series of characters.  So, the following gives
the same results...

>> str: "hello"                   
== "hello"
>> str/2
== #"e"

>> word: to-chars str             
== [#"h" #"e" #"l" #"l" #"o"]
>> word/2
== #"e"

HTH.

-- 
Carl Read

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to