mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Added char-foldcase and char-ci predicates
This commit is contained in:
parent
f671d85ce6
commit
489389a3ee
1 changed files with 15 additions and 1 deletions
|
@ -10,16 +10,25 @@
|
||||||
(export
|
(export
|
||||||
char-alphabetic?
|
char-alphabetic?
|
||||||
char-downcase
|
char-downcase
|
||||||
|
char-foldcase
|
||||||
char-lower-case?
|
char-lower-case?
|
||||||
char-numeric?
|
char-numeric?
|
||||||
char-upcase
|
char-upcase
|
||||||
char-upper-case?
|
char-upper-case?
|
||||||
char-whitespace?
|
char-whitespace?
|
||||||
|
char-ci<=?
|
||||||
|
char-ci<?
|
||||||
|
char-ci=?
|
||||||
|
char-ci>=?
|
||||||
|
char-ci>?
|
||||||
digit-value
|
digit-value
|
||||||
string-upcase
|
string-upcase
|
||||||
string-downcase
|
string-downcase
|
||||||
; TODO:
|
; TODO:
|
||||||
;string-foldcase
|
;string-foldcase
|
||||||
|
;string-ci<=? string-ci<?
|
||||||
|
;string-ci=? string-ci>=?
|
||||||
|
;string-ci>?
|
||||||
)
|
)
|
||||||
(import (scheme base))
|
(import (scheme base))
|
||||||
(begin
|
(begin
|
||||||
|
@ -37,7 +46,12 @@
|
||||||
(- (char->integer #\a)
|
(- (char->integer #\a)
|
||||||
(char->integer #\A))))
|
(char->integer #\A))))
|
||||||
c))
|
c))
|
||||||
; TODO: char-foldcase
|
(define char-foldcase char-downcase) ;; Good enough for now, since no Unicode yet
|
||||||
|
(define (char-ci=? c1 c2 . cs) (apply char=? (map char-foldcase (cons c1 (cons c2 cs)))))
|
||||||
|
(define (char-ci<=? c1 c2 . cs) (apply char<=? (map char-foldcase (cons c1 (cons c2 cs)))))
|
||||||
|
(define (char-ci<? c1 c2 . cs) (apply char<? (map char-foldcase (cons c1 (cons c2 cs)))))
|
||||||
|
(define (char-ci>=? c1 c2 . cs) (apply char>=? (map char-foldcase (cons c1 (cons c2 cs)))))
|
||||||
|
(define (char-ci>? c1 c2 . cs) (apply char>? (map char-foldcase (cons c1 (cons c2 cs)))))
|
||||||
(define (char-alphabetic? c) (or (char-upper-case? c) (char-lower-case? c)))
|
(define (char-alphabetic? c) (or (char-upper-case? c) (char-lower-case? c)))
|
||||||
(define (char-upper-case? c) (and (char>=? c #\A) (char<=? c #\Z))) ;; ASCII-only
|
(define (char-upper-case? c) (and (char>=? c #\A) (char<=? c #\Z))) ;; ASCII-only
|
||||||
(define (char-lower-case? c) (and (char>=? c #\a) (char<=? c #\z))) ;; ASCII-only
|
(define (char-lower-case? c) (and (char>=? c #\a) (char<=? c #\z))) ;; ASCII-only
|
||||||
|
|
Loading…
Add table
Reference in a new issue