Implement set equality.
This commit is contained in:
parent
30664d10f8
commit
575c1cdb3d
7 changed files with 44 additions and 7 deletions
|
@ -30,6 +30,7 @@
|
|||
(
|
||||
string-repeat
|
||||
string-first+rest
|
||||
string-utf8?
|
||||
)
|
||||
|
||||
(import scheme
|
||||
|
@ -57,6 +58,12 @@
|
|||
(val (irregex-replace (irregex "^[ \\t]*" 'u) sep+val "")))
|
||||
(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 (irregex-extract (irregex "." 'u)))))
|
||||
(not (= asciilen utf8len))))
|
||||
|
||||
;; Performs utils module self-tests.
|
||||
(define (utils-tests!)
|
||||
|
@ -77,6 +84,8 @@
|
|||
(test-equal? string-first+rest
|
||||
(string-first+rest "asdf")
|
||||
'("asdf" . ""))
|
||||
(test-true string-utf8? (string-utf8? "ěščř"))
|
||||
(test-false string-utf8? (string-utf8? "Hello World!"))
|
||||
))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue