' Name: String_Compare
' Title: String comparer, character by character
' Description: compare two strings, character by character
' Author: Michael Silberbauer 2001
' Institute for Water Quality Studies.
' set up two test strings

a = "$b25Aq+"
b = "#b3daDWAF"
'b = "$b25Aq+"
' check string lengths

len_a = a.count
len_b = b.count
len = len_a
same = TRUE
if (len_a<>len_b) then
  same = FALSE
  len = len_a.Min(len_b)
  MsgBox.Info("comparing only first"++len.AsString++"characters","WARNING: String lengths differ!")
end

' compare each character, logging results in mat (1=same, 0=differ)

mat = ""
for each i in 1..len
  x = i-1
  str_a = a.Middle(x,1)
  str_b = b.Middle(x,1)
  if (str_a=str_b) then
    mat = mat+"1"
  else
    mat = mat+"0"
    same = FALSE
  end
end
if (same=TRUE) then
  messg = "The two strings are the same:"++a++"="++b
else
  messg = "The two strings differ:"++a++"<>"++b
end
MsgBox.Info(mat,messg)