|
|
Q3018 How can I compare two strings for case-sensitivity?
irt.org | Knowledge Base | ColdFusion | Q3018 [ previous next ] Q3018 How can I compare two strings for case-sensitivity?String1 = "myString" To compare these two strings without case-sensitivity, we would just say:
This CFIF would return a TRUE value, and execute the code between the CFIF tags. However, to make the comparison case-sensitive, we can use the ColdFusion Compare() function.
In this case, the two strings are not the same and will not execute the code between the CFIF tags. The Compare() function performs a check on the ASCII values of the characters in each string. The function returns a negative number if string1 is less than string2, zero(0) if string1 is equal to string2, or a positive number if string1 is greater than string2. Feedback on 'Q3018 How can I compare two strings for case-sensitivity?' |
-- div -->
|