KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Code Snippet: Case Sensitive Comparison of Strings using Generate Digest
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: March 17, 2012

The following code snippet can be used to quickly compare two strings using the MD5 Digest value returned by Generate Digest making the comparrison Case Sensitive:

C_BOOLEAN($0)
C_TEXT($1;$2)
$0:=(Generate digest($1;MD5 Digest)=Generate digest($2;MD5 Digest))


If the code is saved as UTIL_CaseSensitiveCompare it can be used like this:

If (UTIL_CaseSensitiveCompare ($text1;$text2))
// text and case matches
else
// the text and case does not match
end if