Convert subject to list.
This commit is contained in:
parent
947e1c8771
commit
418468f46e
3 changed files with 12 additions and 4 deletions
|
@ -32,6 +32,7 @@
|
|||
string-first+rest
|
||||
string-utf8?
|
||||
string-tests!
|
||||
string->list/utf8
|
||||
)
|
||||
|
||||
(import scheme
|
||||
|
@ -63,8 +64,12 @@
|
|||
;; Returns true, if given string contains UTF-8 characters
|
||||
(define (string-utf8? str)
|
||||
(let ((asciilen (string-length str))
|
||||
(utf8len (length (irregex-extract (irregex "." 'u) str))))
|
||||
(utf8len (length (string->list/utf8 str))))
|
||||
(not (= asciilen utf8len))))
|
||||
|
||||
;; Converts given UTF-8 string into a list of UTF-8 string characters.
|
||||
(define (string->list/utf8 str)
|
||||
(irregex-extract (irregex "." 'u) str))
|
||||
|
||||
;; Performs utils module self-tests.
|
||||
(define (string-tests!)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue