2019-07-15 12:21:50 +00:00
|
|
|
[< back to index](../doc_index.md)
|
2018-12-19 18:01:53 +00:00
|
|
|
|
|
|
|
## string
|
|
|
|
|
2020-03-31 17:07:35 +00:00
|
|
|
The `string` module automatically imports the [`err` module](./other.md).
|
2018-12-19 18:01:53 +00:00
|
|
|
|
2019-09-03 23:22:40 +00:00
|
|
|
All the functions are designed to work for the strings in the default encoding.
|
|
|
|
If passed a string in an encoding that has a different null terminator,
|
|
|
|
then the results are undefined and the program will most likely crash or freeze.
|
|
|
|
|
2018-12-19 18:01:53 +00:00
|
|
|
#### `byte strzlen(pointer str)`
|
|
|
|
|
|
|
|
Calculates the length of a null-terminated string.
|
|
|
|
If the string is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
|
|
|
|
|
|
|
#### `sbyte strzcmp(pointer str1, pointer str2)`
|
|
|
|
|
2019-06-05 09:46:06 +00:00
|
|
|
Compares two null-terminated strings. Returns 0 if equal, non-0 if not equal.
|
2018-12-19 18:01:53 +00:00
|
|
|
If any of the strings is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
|
|
|
|
|
|
|
#### `void strzcopy(pointer dest, pointer src)`
|
|
|
|
|
2019-11-04 01:29:16 +00:00
|
|
|
Copies the source null-terminated string into the destination buffer, including the string terminator.
|
|
|
|
If the source string is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
|
|
|
|
|
|
|
#### `void strzpaste(pointer dest, pointer src)`
|
|
|
|
|
|
|
|
Copies the source null-terminated string into the destination buffer, excluding the string terminator.
|
2018-12-19 18:01:53 +00:00
|
|
|
If the source string is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
|
|
|
|
|
|
|
#### `word strz2word(pointer str)`
|
|
|
|
|
|
|
|
Converts a null-terminated string to a number.
|
|
|
|
Sets `errno`.
|
2019-01-05 00:19:14 +00:00
|
|
|
|
|
|
|
#### `void strzappend(pointer buffer, pointer str)`
|
|
|
|
#### `void strzappendchar(pointer buffer, byte char)`
|
|
|
|
|
2019-06-05 09:46:06 +00:00
|
|
|
Modifies the given null-terminated buffer by appending a null-terminated string or a single character respectively.
|
2019-10-31 16:29:05 +00:00
|
|
|
|
|
|
|
## scrstring
|
|
|
|
|
2020-04-05 22:42:52 +00:00
|
|
|
The `scrstring` module automatically imports the `string` and [`err`](./other.md) modules.
|
2019-10-31 16:29:05 +00:00
|
|
|
|
|
|
|
It contains functions for handling strings in the screen encoding with the same semantics as the functions from the string module.
|
|
|
|
|
|
|
|
#### `byte scrstrzlen(pointer str)`
|
|
|
|
#### `sbyte scrstrzcmp(pointer str1, pointer str2)`
|
|
|
|
#### `void scrstrzcopy(pointer dest, pointer src)`
|
2019-11-04 01:29:16 +00:00
|
|
|
#### `void scrstrzpaste(pointer dest, pointer src)`
|
2019-10-31 16:29:05 +00:00
|
|
|
#### `word scrstrz2word(pointer str)`
|
|
|
|
#### `void scrstrzappend(pointer buffer, pointer str)`
|
|
|
|
#### `void scrstrzappendchar(pointer buffer, byte char)`
|
2020-04-05 22:44:20 +00:00
|
|
|
|
|
|
|
## pstring
|
|
|
|
|
2020-07-24 20:18:25 +00:00
|
|
|
The `pstring` module automatically imports the [`err` module](./other.md).
|
2020-04-05 22:44:20 +00:00
|
|
|
|
|
|
|
It contains functions for handling length-prefixed strings in any 8-bit encoding.
|
|
|
|
|
|
|
|
#### `byte pstrlen(pointer str)`
|
|
|
|
#### `sbyte pstrcmp(pointer str1, pointer str2)`
|
|
|
|
#### `void pstrcopy(pointer dest, pointer src)`
|
|
|
|
#### `void pstrpaste(pointer dest, pointer src)`
|
|
|
|
#### `void pstrappend(pointer buffer, pointer str)`
|
|
|
|
#### `void pstrappendchar(pointer buffer, byte char)`
|
2020-07-24 20:18:25 +00:00
|
|
|
#### `word pstr2word(pointer str)`
|
|
|
|
|
|
|
|
Converts a length-prefixed string to a number. Uses the default encoding.
|
|
|
|
Sets `errno`.
|
|
|
|
|
|
|
|
#### `word pscrstr2word(pointer str)`
|
|
|
|
|
|
|
|
Converts a length-prefixed string to a number. Uses the screen encoding.
|
|
|
|
Sets `errno`.
|