Compare two string up to the length of the second string.
hcl
string=-limited string1 string2 &optional start1 => boolean
string-equal-limited string1 string2 &optional start1 => boolean
A string designator. | |
start1⇩ |
An integer. |
boolean |
A boolean. |
The functions string=-limited
and string-equal-limited
compare string1 and string2, with the comparison limited by the length of string2. string=-limited
compares the characters as if using char=, while string-equal-limited
compare the characters as if using char-equal.
start1 defaults to 0, and specifies an index into string1 where the comparison should start.
If start1 plus the length of string2 is bigger than the length string1, then false is returned. Otherwise, the part of string1 starting from start1 is compared with string2 up to the length of string2, and true is returned if the characters are the same.
string=-limited
and string-equal-limited
are intended to simplify comparison in typical cases where you read a string from "somewhere" (for example, a line from a configuration file), and want to check if the start of this string matches something. In particular, they avoid the need to check the length of the strings.
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:35