Strings: string.ss

Next: Syntax Rules: synrule.ss Up: MzLib Libraries Previous: MrSpidey: spidey.ss

## Strings: `string.ss`

Files: `string.ss`, `stringu.ss`, `stringr.ss`, `strings.ss`
Signature: `mzlib:string^`
Unit: `mzlib:string@`, no imports

`(eval-string str [err-display err-result])` PROCEDURE

Reads and evaluates S-expressions from the string str, returning a result for each expression. Note that if str contains only whitespace and comments, zero values are returned, while if str contains two expressions, two values are returned.

If err-display is not `#f` (the default), then errors are caught and err-display is used as the error display handler. If err-result is specified, it must be a thunk that returns a value to be returned when an error is caught; otherwise, `#f` is returned when an error is caught.

`(expr->string expr)` PROCEDURE

Prints expr into a string and returns the string.

`newline-string` STRING

A string containing a single newline character.

`(read-from-string str [err-display err-result])` PROCEDURE

Reads the first S-expression from the string str and returns it. The err-display and err-result are as in `eval-str`.

`(read-from-string-all str [err-display err-result])` PROCEDURE

Reads all S-expressions from the string str and returns them in a list. The err-display and err-result are as in `eval-str`.

`(regexp-match-exact? regexp str)` PROCEDURE

This procedure is like MzScheme's built-in `regexp-match`, but the result is always `#t` or `#f`; `#t` is only returned when the entire string str matches regexp.

`(string-lowercase! str)` PROCEDURE

Destructively changes str to contain only lowercase characters.

`(string-uppercase! str)` PROCEDURE

Destructively changes str to contain only uppercase characters.