Move simplified string-utf8? to util-utf8.

This commit is contained in:
Dominik Pantůček 2023-06-24 22:05:20 +02:00
parent 0b383c6fa6
commit 06746c1c40
4 changed files with 12 additions and 11 deletions

View file

@ -30,8 +30,6 @@
(
string-first+rest
string-utf8?
string->qp
string-upcase
@ -56,12 +54,6 @@
(cons key-str val))
(cons str ""))))
;; Returns true, if given string contains UTF-8 characters
(define (string-utf8? str)
(let ((asciilen (string-length 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))
@ -111,8 +103,6 @@
(test-equal? string-first+rest
(string-first+rest "asdf")
'("asdf" . ""))
(test-true string-utf8? (string-utf8? "ěščř"))
(test-false string-utf8? (string-utf8? "Hello World!"))
(test-equal? string->qp
(string->qp "asdf")
"asdf")