Symisc Systems

Libcox Command Reference


Star Follow @symisc

Command Syntax

substr_compare main_string string offset [length] [case_insensitivity = false]


Alias

None


Description

Binary safe comparison of two strings from an offset, up to length characters.


Parameters

main_string

The main string being compared.

string

The secondary string being compared.

offset

The start position for the comparison. If negative, it starts counting from the end of the string.

length

Optional Parameter: The length of the comparison. The default value is the largest of the length of the str compared to the length of main_str less the offset.

case_insensitivity

Optional Parameter: If case_insensitivity is TRUE(1), comparison is case insensitive.


Return Value

Integer/Boolean: Returns < 0 if main_string from position offset is less than string, > 0 if it is greater than str, and 0 if they are equal. If offset is equal to or greater than the length of main_string or length is set and is less than 1, substr_compare returns FALSE. Use libcox_value_to_int() or libcox_value_to_bool()to extract the processing result.