manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6.5.2 String Predicates

The following procedures can be used to check whether a given string fulfills some specified property.

Scheme Procedure: string? obj
C Function: scm_string_p (obj)

Return #t if obj is a string, else #f.

C Function: int scm_is_string (SCM obj)

Returns 1 if obj is a string, 0 otherwise.

Scheme Procedure: string-null? str
C Function: scm_string_null_p (str)

Return #t if str’s length is zero, and #f otherwise.

(string-null? "")  ⇒ #t
y                    ⇒ "foo"
(string-null? y)     ⇒ #f
Scheme Procedure: string-any char_pred s [start [end]]
C Function: scm_string_any (char_pred, s, start, end)

Check if char_pred is true for any character in string s.

char_pred can be a character to check for any equal to that, or a character set (see section Character Sets) to check for any in that set, or a predicate procedure to call.

For a procedure, calls (char_pred c) are made successively on the characters from start to end. If char_pred returns true (ie. non-#f), string-any stops and that return value is the return from string-any. The call on the last character (ie. at end-1), if that point is reached, is a tail call.

If there are no characters in s (ie. start equals end) then the return is #f.

Scheme Procedure: string-every char_pred s [start [end]]
C Function: scm_string_every (char_pred, s, start, end)

Check if char_pred is true for every character in string s.

char_pred can be a character to check for every character equal to that, or a character set (see section Character Sets) to check for every character being in that set, or a predicate procedure to call.

For a procedure, calls (char_pred c) are made successively on the characters from start to end. If char_pred returns #f, string-every stops and returns #f. The call on the last character (ie. at end-1), if that point is reached, is a tail call and the return from that call is the return from string-every.

If there are no characters in s (ie. start equals end) then the return is #t.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on February 3, 2012 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.