"STRN" String functions
Fingerprint ID: | 0x5354524e |
This fingerprint, from RC/Funge-98, implements operations on null-terminated string (“0gnirts”). It provides the following commands:
- A : as bs — strs
- Append b to a.
- C : bs as — n
- Pushes -1 if a is lexicographically less than b, 1 if greater than, and 0 otherwise.
- D : strs —
- Prints the string.
- F : needles haystacks — strs
- Pushes the longest suffix of haystack starting with needle. Pushes null string (i.e. one zero) if needle is not in haystack.
- G : posv — strs
- Gets the string from given position. It scans Funge space rightwards, from pos to first zero cell (as done by P command). Reflects if no zero cell found.
- I : — strs
- Reads the string from standard input, discarding the trailing newline. Reflects at EOF.
- L : strs n — strs
- Pushes leftmost (at most) n characters of str. Reflects if n is negative.
- M : strs s n — strs
- Pushes the substring of str starting at offset s ending at offset s+n. The offset is 0 at the first character. If the ending offset is past the end of string, pushes less than n characters. Reflects if n is negative or the starting offset is out of bound.
- N : strs n — strs
- Pushes the length of string, except trailing zero. Retains the original string.
- P : strs posv —
- Puts the string to given position. It writes each characters of str rightwards, and writes zero cell at the end.
- R : strs n — strs
- Pushes rightmost (at most) n characters of str. Reflects if n is negative.
- S : n — strs
- Pushes the string representation of n.
- V : strs — n
- Parses the string representation of number. It works like atoi(3) call, but reflects for invalid input.