Move non-empty-string? to racket/string.

From `unstable/contract`.
This commit is contained in:
Vincent St-Amour 2015-09-08 10:09:29 -05:00
parent 261b7bde28
commit 5f43b3a913
2 changed files with 12 additions and 1 deletions

View File

@ -507,6 +507,13 @@ trimmed (which is an alternative to using a @tech{regular expression}
(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"]

View File

@ -5,7 +5,8 @@
string-trim
string-normalize-spaces
string-split
string-replace)
string-replace
non-empty-string?)
(define string-append*
(case-lambda [(strs) (apply string-append strs)] ; optimize common cases
@ -134,3 +135,6 @@
(if all?
(regexp-replace* from* str to*)
(regexp-replace from* str to*)))
(define (non-empty-string? x)
(and (string? x) (not (zero? (string-length x)))))