Implement string-upcase and document it.
This commit is contained in:
parent
ab0d2cfd8e
commit
c634bf733f
2 changed files with 18 additions and 0 deletions
|
@ -448,6 +448,13 @@ characters of the string.
|
||||||
Returns a new string with all non-ASCII characters encoded as
|
Returns a new string with all non-ASCII characters encoded as
|
||||||
quoted-printable sequences.
|
quoted-printable sequences.
|
||||||
|
|
||||||
|
(string-upcase str)
|
||||||
|
|
||||||
|
* ```str``` - arbitrary string
|
||||||
|
|
||||||
|
Returns the ```str``` with all characters converted to upper case
|
||||||
|
using ```char-upcase```. Does not work with UTF-8.
|
||||||
|
|
||||||
### Tag
|
### Tag
|
||||||
|
|
||||||
(import util-tag)
|
(import util-tag)
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
string->qp
|
string->qp
|
||||||
|
|
||||||
|
string-upcase
|
||||||
|
|
||||||
string-tests!
|
string-tests!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,6 +104,12 @@
|
||||||
"")))
|
"")))
|
||||||
res)))))
|
res)))))
|
||||||
|
|
||||||
|
;; Returns upper-case version of the string
|
||||||
|
(define (string-upcase str)
|
||||||
|
(list->string
|
||||||
|
(map char-upcase
|
||||||
|
(string->list str))))
|
||||||
|
|
||||||
;; Performs utils module self-tests.
|
;; Performs utils module self-tests.
|
||||||
(define (string-tests!)
|
(define (string-tests!)
|
||||||
(run-tests
|
(run-tests
|
||||||
|
@ -129,6 +137,9 @@
|
||||||
(test-equal? string->qp
|
(test-equal? string->qp
|
||||||
(string->qp "asdfásdf")
|
(string->qp "asdfásdf")
|
||||||
"asdf=c3=a1sdf")
|
"asdf=c3=a1sdf")
|
||||||
|
(test-equal? string-upcase
|
||||||
|
(string-upcase "asdFGH")
|
||||||
|
"ASDFGH")
|
||||||
))
|
))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue