____ ____ ____ ____ ||n |||i |||m |||f || ||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|
The nimf text module provides helpers for dealing with characters and strings. Character helpers begin with the prefix `ch.` and string helpers begin with `str.`. This listing does not include any private words used within the module.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is a lowercase character and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is an uppercase character and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is an alpha character (A-Z or a-z) and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is a digit character (0-9) and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is a digit character (0-9) or an alpha character (A-Z or a-z) and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is in the range of ascii characters and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is a printable character (has a visual representation) and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is a printable character (has a visual representation) in the range of ascii characters and 0 otherwise.
Signature: ( ch -- flag )
Description: Eats acharacter from TOS and leaves -1 on the stack if it is a whitespace character and 0 otherwise.
Note: This word is designed to be used to test for ascii whitespace and cannot be used to determine non-ascii range utf-8 whitespace.
Signature: ( ch -- flag )
Description: Eats a character from TOS and leaves -1 on the stack if it is a punctuation character and 0 otherwise.
Note: This word is designed to be used to test for ascii punctuation and cannot be used to determine full utf-8 punctuation.
Signature: ( ch -- CH )
Description: Eats a character from TOS and leaves an uppercase version of any character between a and z. Any other characters will be left unaltered.
Note: This word is designed to work with ascii range characters and will leave all other utf-8 characters unaltered.
Signature: ( CH -- ch )
Description: Eats a character from TOS and leaves a lowercase version of any character between A and Z. Any other characters will be left unaltered.
Note: This word is designed to work with ascii range characters and will leave all other utf-8 characters unaltered.
Signature: ( sptr -- _ )
Description: Eats a string pointer from TOS and prints the string stored at that address. Leaves nothing on the stack.
Signature: ( _ -- _ )
Description: Prints the string currently held in the temporary string buffer. Takes nothing from, and leaves nothing on, the stack.
Signature: ( sptr sptr -- flag )
Description: Eats two string pointers from TOS and leaves a flag representing whether the strings are equal, as in: are the same length and contain the same characters; not as in: they are the same memory address, though the same address put in would be equal and result in -1 on the stack.
Signature: ( ch sptr -- offset )
Description: Eats a string pointer and a character from TOS. Searches that string for the given character and leaves the offset of the first instance of that character on the stack, or -1 if the character could not be found in the string.
Signature: ( ch sptr offset1 -- offset2 )
Description: Eats an offset value, a string pointer, and a character from TOS. Searches that string for the given character starting at the given offset and leaves the first instance of that character on the stack, or -1 if the character could not be found in the string.
Signature: ( start end sptr -- _ )
Description: Moves a substring to the temporary string buffer. Eats a string pointer, and ending offset, and a starting offset from TOS. start and end are both inclusive (ie. a start of 2 and end of 4 would result in a string with a length of 3, not 1 or 2). Leaves nothing on the stack. If the start and end range extends beyond the string bounds or the end offset is less than the start offset an error will be raised.
Signature: ( ch sptr -- n )
Description: Eats a string pointer and a character from TOS and leave the number of times the character is found in the given string.
Signature: ( ch start end sptr -- n )
Description: Eats a string pointer, an ending offset, a starting offset, and a character from TOS and leaves the number of times the character is found within the offset range of the given string. If the end offset is larger than the string bounds, it will be adjusted to the bounds of the string. If the end offset is less than the start offset 0 will be left on the stack.
Signature: ( ch sptr -- _ )
Descriptioin: Eats a string pointer and a character from TOS. Appends the char to the end of the string. It is the callers responsibility to make sure there is room for the char in memory. As a result, this word should be called with care so as to not overwrite areas of memory unexpectedly. Leaves nothing on the stack.
Signature: ( sptr -- flag )
Description: Eats a string pointer from TOS and leaves a flag indicating whether the given string represents a number (positive or negative, not a decimal).