Adding string-offset->index.

This commit is contained in:
Alex Shinn 2013-07-15 15:22:45 +09:00
parent beb325a0d1
commit 4ffa62d4ef

View file

@ -1199,9 +1199,12 @@
(cond-expand (cond-expand
(full-unicode (full-unicode
(define string-cursor-end string-size)) (define string-cursor-end string-size)
(define (string-offset->index str off)
(string-length (substring-cursor str 0 off))))
(else (else
(define (string-index->offset str i) i) (define (string-index->offset str i) i)
(define (string-offset->index str off) off)
(define string-size string-length) (define string-size string-length)
(define substring-cursor substring) (define substring-cursor substring)
(define string-cursor-end string-length) (define string-cursor-end string-length)