(js!bool
(js!selfcall
"var x = " x ";" *newline*
- "return (typeof(" x ") == \"string\") && x.length == 1;")))
+ "return (typeof(" x ") == \"string\") && (x.length == 1 || x.length == 2);")))
-(define-builtin char-to-string (x)
- (js!selfcall
- "var r = [" x "];" *newline*
- "r.type = 'character';"
- "return r"))
-
(define-builtin char-upcase (x)
- (code x ".toUpperCase()"))
+ (code "safe_char_upcase(" x ")"))
(define-builtin char-downcase (x)
- (code x ".toLowerCase()"))
+ (code "safe_char_downcase(" x ")"))
(define-builtin stringp (x)
(js!bool
// Create and return a lisp string for the Javascript string STRING.
function make_lisp_string (string){
- var array = string.split("");
- array.stringp = 1;
+ var array = codepoints(string);
- array.type = 'character'
++ array.stringp = 1
return array;
}