CompareStrings(), StrEq()

Summary

Compares two strings to see if they match.

Changes

Added to Version 2014.

Syntax

string = CompareStrings (string s1, string s2 [, array opts])

Argument Contents
s1 The first of the two strings to compare
s2 The second of the two strings to compare
Option Type Contents
Case Sensitive Boolean If "True" the comparison is case sensitive, if "False" (the default) the comparison is not case sensitive

Returns

Returns a boolean "True" (if they match) or "False" (if they don't)

Notes

  • A null value for either is considered an empty string, so if they are both null, CompareStrings() returns "True"; if one is null, CompareStrings() returns "False"

  • Can also be called as StrEq().

Examples

str1 = null
 str2 = null
 ret = CompareStrings(str1, str2,)
 // ret = "True"
str1 = "foo" // str2 is still null
 ret = CompareStrings(str1, str2,)
 // ret = "False"
str2 = "Foo" // str1 is still "foo"
 ret = CompareStrings(str1, str2,)
 // ret = "True"
// str1 is still "foo" and str2 is still "Foo"
 ret = CompareStrings(str1, str2, {{"Case Sensitive", True}})
 // ret = "False"

See Also

Function Summary
CompareStrings() Compares two strings to see if they match
JoinStrings() Returns a concatenated string separated by the delimiter
ParseString() Divides a string into pieces separated by the specified delimiters
SplitString() Divides a string into pieces based on the position of vertical bars (|) in that string
StrEq() Compares two strings to see if they match.
Word() Extracts one word from a string