Move non-empty-string?
to racket/string
.
From `unstable/contract`.
This commit is contained in:
parent
261b7bde28
commit
5f43b3a913
|
@ -507,6 +507,13 @@ trimmed (which is an alternative to using a @tech{regular expression}
|
||||||
(string-trim "aaaxaayaa" "aa")
|
(string-trim "aaaxaayaa" "aa")
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@defproc[(non-empty-string? [x any/c]) boolean?]{
|
||||||
|
Returns @racket[#t] if @racket[x] is a string and is not empty;
|
||||||
|
returns @racket[#f] otherwise.
|
||||||
|
@history[#:added "6.2.900.15"]{}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@; ----------------------------------------
|
@; ----------------------------------------
|
||||||
@include-section["format.scrbl"]
|
@include-section["format.scrbl"]
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
string-trim
|
string-trim
|
||||||
string-normalize-spaces
|
string-normalize-spaces
|
||||||
string-split
|
string-split
|
||||||
string-replace)
|
string-replace
|
||||||
|
non-empty-string?)
|
||||||
|
|
||||||
(define string-append*
|
(define string-append*
|
||||||
(case-lambda [(strs) (apply string-append strs)] ; optimize common cases
|
(case-lambda [(strs) (apply string-append strs)] ; optimize common cases
|
||||||
|
@ -134,3 +135,6 @@
|
||||||
(if all?
|
(if all?
|
||||||
(regexp-replace* from* str to*)
|
(regexp-replace* from* str to*)
|
||||||
(regexp-replace from* str to*)))
|
(regexp-replace from* str to*)))
|
||||||
|
|
||||||
|
(define (non-empty-string? x)
|
||||||
|
(and (string? x) (not (zero? (string-length x)))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user