Byte Vectors - MIT/GNU Scheme 9.1
Description: MIT/GNU Scheme 9.1

Previous: Variable-Length Strings, Up: Strings

### 6.11 Byte Vectors

MIT/GNU Scheme implements strings as packed vectors of 8-bit ISO-8859-1 bytes. Most of the string operations, such as `string-ref`, coerce these 8-bit codes into character objects. However, some lower-level operations are made available for use.

— procedure: vector-8b-ref string k

> Returns character k of string as an ISO-8859-1 code. K must be a valid index of string.

>               (vector-8b-ref "abcde" 2)               =>  99 ;c

— procedure: vector-8b-set! string k code

> Stores code in element k of string and returns an unspecified value. K must be a valid index of string, and code must be a valid ISO-8859-1 code.

— procedure: vector-8b-fill! string start end code

> Stores code in elements start (inclusive) to end (exclusive) of string and returns an unspecified value. Code must be a valid ISO-8859-1 code.

— procedure: vector-8b-find-next-char string start end code
— procedure: vector-8b-find-next-char-ci string start end code

> Returns the index of the first occurrence of code in the given substring; returns `#f` if code does not appear. The index returned is relative to the entire string, not just the substring. Code must be a valid ISO-8859-1 code.

> `vector-8b-find-next-char-ci` doesn't distinguish uppercase and lowercase letters.

— procedure: vector-8b-find-previous-char string start end code
— procedure: vector-8b-find-previous-char-ci string start end code

> Returns the index of the last occurrence of code in the given substring; returns `#f` if code does not appear. The index returned is relative to the entire string, not just the substring. Code must be a valid ISO-8859-1 code.

> `vector-8b-find-previous-char-ci` doesn't distinguish uppercase and lowercase letters.