(vector-8b? string?)
ascii-string-copy
burst-string
- camel-case-string->lisp
char->string
decorated-string-append
error:not-string
guarantee-substring
guarantee-substring-end-index
guarantee-substring-start-index
- lisp-string->camel-case
list->string
make-string
make-vector-8b
(%substring-upcase! string index (fix:+ index 1))
(%substring-downcase! string (fix:+ index 1) end)))))
\f
-;;;; CamelCase support
-
-(define (camel-case-string->lisp string)
- (call-with-input-string string
- (lambda (input)
- (call-with-output-string
- (lambda (output)
- (let loop ((prev #f))
- (let ((c (read-char input)))
- (if (not (eof-object? c))
- (begin
- (if (and prev (char-upper-case? c))
- (write-char #\- output))
- (write-char (char-downcase c) output)
- (loop c))))))))))
-
-(define (lisp-string->camel-case string #!optional upcase-initial?)
- (call-with-input-string string
- (lambda (input)
- (call-with-output-string
- (lambda (output)
- (let loop
- ((upcase?
- (if (default-object? upcase-initial?)
- #t
- upcase-initial?)))
- (let ((c (read-char input)))
- (if (not (eof-object? c))
- (if (char-alphabetic? c)
- (begin
- (write-char (if upcase? (char-upcase c) c) output)
- (loop #f))
- (begin
- (if (or (char-numeric? c)
- (eq? c #\_))
- (write-char c output))
- (loop #t)))))))))))
-\f
;;;; Replace
(define (string-replace string char1 char2)
vector-8b-ref
vector-8b-set!)
(export ()
- camel-case-string->lisp
guarantee-substring
guarantee-substring-end-index
guarantee-substring-start-index
- lisp-string->camel-case
reverse-string
reverse-substring
string-compare
(string-set! result j (string-ref string i)))
result)))
\f
-;;;; CamelCase support
-
-(define (camel-case-string->lisp string)
- (call-with-input-string string
- (lambda (input)
- (call-with-output-string
- (lambda (output)
- (let loop ((prev #f))
- (let ((c (read-char input)))
- (if (not (eof-object? c))
- (begin
- (if (and prev (char-upper-case? c))
- (write-char #\- output))
- (write-char (char-downcase c) output)
- (loop c))))))))))
-
-(define (lisp-string->camel-case string #!optional upcase-initial?)
- (call-with-input-string string
- (lambda (input)
- (call-with-output-string
- (lambda (output)
- (let loop
- ((upcase?
- (if (default-object? upcase-initial?)
- #t
- upcase-initial?)))
- (let ((c (read-char input)))
- (if (not (eof-object? c))
- (if (char-alphabetic? c)
- (begin
- (write-char (if upcase? (char-upcase c) c) output)
- (loop #f))
- (begin
- (if (or (char-numeric? c)
- (eq? c #\_))
- (write-char c output))
- (loop #t)))))))))))
-\f
;;;; Replace
(define (string-replace string char1 char2)