[plt-scheme] Re: Text-contents to a function variable

From: Thomas Chust (chust at web.de)
Date: Wed Jan 13 09:08:16 EST 2010

2010/1/13 Avi <n4alpaca at gmail.com>:
> [...] I tried defining a letter as the
> numerical value of a string, but it did not work very well, maybe
> there are better methods? [...]

Hello Avi,

I don't understand what you mean by this.

Do you want to convert a number representing a code point and which is
encoded as a string into a character? In that case something like
(integer->char (string->number "1234")) will do the job.

Or do you have a string containing something else than digits and want
to convert it into a number? In that case you will have to write a
custom conversion function, since the standard library functions don't
know how you want to interpret the characters.

Or maybe the number you are given in string representation just isn't
decimal? Then using the second, optional, parameter of string->number
will help, eg. (string->number "deadbeef" 16).


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.