Next: , Previous: , Up: args predefined   [Index]


8.5.12 Validating string and related arguments

The following bindings are exported by the library (vicare arguments validation).

Validation Clause: string obj

Succeed if obj is a string.

Validation Clause: string/false obj

Succeed if obj is #f or a string.

Validation Clause: non-empty-string obj

Succeed if obj is a string and its length is greater than zero.

Validation Clause: non-empty-string/false obj

Succeed if obj is #f or a string and its length is greater than zero.

Validation Clause: list-of-strings obj

Succeed if obj is null or a list of strings.

Validation Clause: string-or-symbol obj
Validation Clause: string-or-symbol-or-false obj

Succeed if obj is a string or symbol; the second clause accepts also #f.

Validation Clause: index-for-string str idx

Succeed if idx is a fixnum usable as index (not out of range) for str, which is expected to be an already validated string. idx must satisfy the constraints:

0 <= idx < (string-length str)
Validation Clause: one-off-index-for-string str idx

Succeed if idx is a fixnum usable as index for str, which is expected to be an already validated string, or it is equal to the string length. idx must satisfy the constraints:

0 <= idx <= (string-length str)
Validation Clause: index-and-count-for-string str idx count

Assuming that str is an already validated string: succeed if idx is a fixnum usable as index (not out of range) for str, and count is a fixnum which can be used as characters count in str starting and idx without going out of range.

In other words: idx and count select a substring of str.

Validation Clause: start-and-end-for-string str start end

Assuming that str is an already validated string: succeed if both start and end are fixnums usable as indexes (not out of range) for str, and start is less than or equal to end.

In other words: start and end select a substring of str by specifying inclusive limits.

Validation Clause: start-and-past-for-string str start past

Assuming that str is an already validated string: succeed if both start and past are fixnums satisfying the constraints:

0 <= start <= (string-length str)
start <= past <= (string-length str)

In other words: start and past select a substring of str by specifying left–inclusive and right–exclusive limits.


Next: , Previous: , Up: args predefined   [Index]