[plt-scheme] string->symbol and case
You can, if you want, just downcase the string as
(define (lower-case-char char)
(if (not (char? char))
(error '......))
(integer->char (let ([i (char->integer i)])
(if (<= 65 i 80) ; not sure about the numbers, you
should check
(+ i 32)
i))))
(define (lower-case str)
(if (not (string? str))
(error '.......))
(list->string (map lower-case-char (string->list str))))
(eval (string->symbol (lower-case "AA")))
Robby Findler wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>At Sat, 17 May 2003 02:46:13 +0200, Vincent Hourdin wrote:
>
>
>>Thank you Robby, can I use something more global for setting case sensitivity
>>for read ? I have got 40 functions to use with upper case and I dont really
>>want to add #cs on each.
>>Maybe is there a way to eval a func given its name in a string, independently
>>its case ?
>>Thank you again
>>
>>
>
>The other two options (besides #cs) is to set the case sensitivity in
>DrScheme's language dialog, or to prefix your program with:
>
> (read-case-sensitive #t)
>
>The #cs is a more scalable solution, since larger programs tend to be
>written in modules, so you can prefix the entire module with #cs. If
>you just have a small program, read-case-sensitive at the top is
>probably fine.
>
>Robby
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20030517/0b678e46/attachment.html>