Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

make string!

 [1/6] from: ryan::christiansen::intellisol::com at: 26-Jun-2001 17:02


Try as I might, I am unable to make an integer! value into a string! value, EXCEPT when I use 'append to append the integer! value to a string! value. Why can 'append take care of changing the datatype while make string! cannot? For example:
>> a: 2
== 2
>> b: make string! a
== ""
>> b
== ""
>> b: make string! 1
== ""
>> append b a
== "2"
>> b
== "2"
>> string? b
== true
>>
Ryan C. Christiansen Web Developer Intellisol International 4733 Amber Valley Parkway Fargo, ND 58104 701-235-3390 ext. 6671 FAX: 701-235-9940 http://www.intellisol.com Global Leader in People Performance Software _____________________________________ Confidentiality Notice This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email to [ryan--christiansen--intellisol--com]

 [2/6] from: ryanc:iesco-dms at: 26-Jun-2001 15:50


Hey Ryan, Your just full of questions today. Usually in this case I use 'to-string. If you must use make, here is something to chew on:
>> make string! [3]
== "3" --Ryan [ryan--christiansen--intellisol--com] wrote:
> Try as I might, I am unable to make an integer! value into a string! value, > EXCEPT when I use 'append to append the integer! value to a string! value.
<<quoted lines omitted: 35>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400

 [3/6] from: holger:rebol at: 26-Jun-2001 16:27


On Tue, Jun 26, 2001 at 05:02:59PM -0500, [ryan--christiansen--intellisol--com] wrote:
> Try as I might, I am unable to make an integer! value into a string! value, > EXCEPT when I use 'append to append the integer! value to a string! value.
<<quoted lines omitted: 4>>
> >> b: make string! a > == ""
make string! 2 allocates an empty string of length 2, i.e. a string that has enough pre-allocated space to hold two characters without any performance penalty. It does not convert the number 2 to a string. -- Holger Kruse [holger--rebol--com]

 [4/6] from: joel:neely:fedex at: 26-Jun-2001 14:45


Hi, Ryan, [ryan--christiansen--intellisol--com] wrote:
> Try as I might, I am unable to make an integer! value into a > string! value, EXCEPT when I use 'append to append the
<<quoted lines omitted: 5>>
> >> b: make string! a > == ""
The meaning of make string! 2 (with anything that evaluates to 2 in that last position, *including* a word set to 2) is to ask REBOL to create a new string with enough space "pre-allocated" to hold 2 characters before having to grab more space. If you want to convert an integer to a string, try any of
>> a: 234 == 234 >> to-string a == "234" >> mold a == "234" >> form a == "234"
or the truly baroque ;-)
>> make string! reduce [a] == "234"
HTH! -jn- -- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com

 [5/6] from: steve:shireman:semaxwireless at: 27-Jun-2001 7:06


How about 'to-string ? (or is this _too_ awkward? ;-)
>> tu: to-string 2
== "2"
>> tu
== "2" tu tu tu tee du... Steve Shireman went _to_ a one-liner conference, where one one-liner won Firesign Theatre on radio Holger Kruse wrote:

 [6/6] from: ryan:christiansen:intellisol at: 27-Jun-2001 8:21


I had to slap the side of my head. I should've known the answer to this one. -Ryan Holger Kruse <[holger--rebol] To: [rebol-list--rebol--com] .com> cc: Sent by: Subject: [REBOL] Re: make string! rebol-bounce@ rebol.com 06/26/2001 06:27 PM Please respond to rebol-list On Tue, Jun 26, 2001 at 05:02:59PM -0500, [ryan--christiansen--intellisol--com] wrote:
> Try as I might, I am unable to make an integer! value into a string!
value,
> EXCEPT when I use 'append to append the integer! value to a string!
value.
> Why can 'append take care of changing the datatype while make string! > cannot? For example: > > >> a: 2 > == 2 > >> b: make string! a > == ""
make string! 2 allocates an empty string of length 2, i.e. a string that has enough pre-allocated space to hold two characters without any performance penalty. It does not convert the number 2 to a string. -- Holger Kruse [holger--rebol--com]

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted