Overrides MfObject.Equals()
OutputVar := instance.Equals(sb)
Returns a value indicating whether this instance is equal to a specified StringBuilder.
sb
An StringBuilder to compare with this instance.
true if this instance and sb have equal string, Capacity, and MaxCapacity values; otherwise, false.
The following code uses the Equals method to check whether two StringBuilder objects are equal. The method is called repeatedly after small changes are made to each object.
sb := new MfText.StringBuilder()
sb1 := new MfText.StringBuilder("abc")
sb2 := new MfText.StringBuilder("abc", 16)
sb.AppendLine()
sb.AppendFormat("a1) sb1.Length = {0}, sb1.Capacity = {1}", sb1.Length, sb1.Capacity)
sb.AppendLine()
sb.AppendFormat("a2) sb2.Length = {0}, sb2.Capacity = {1}", sb2.Length, sb2.Capacity)
sb.AppendLine()
sb.AppendFormat("a3) sb1.ToString() = '{0}', sb2.ToString() = '{1}'", sb1.ToString(), sb2.ToString())
sb.AppendLine()
sb.AppendFormat("a4) sb1 equals sb2: {0}", sb1.Equals(sb2) = true?"true":"false")
sb.AppendLine()
sb.AppendLine()
sb.AppendLine("Ensure sb1 has a capacity of at least 50 characters.")
sb.AppendLine()
sb1.EnsureCapacity(50)
sb.AppendFormat("b1) sb1.Length = {0}, sb1.Capacity = {1}", sb1.Length, sb1.Capacity)
sb.AppendLine()
sb.AppendFormat("b2) sb2.Length = {0}, sb2.Capacity = {1}", sb2.Length, sb2.Capacity)
sb.AppendLine()
sb.AppendFormat("b3) sb1.ToString() = '{0}', sb2.ToString() = '{1}'", sb1.ToString(), sb2.ToString())
sb.AppendLine()
sb.AppendFormat("b4) sb1 equals sb2: {0}", sb1.Equals(sb2) = true?"true":"false")
sb.AppendLine()
sb.AppendLine()
sb.AppendLine("Set the length of sb1 to zero.")
sb.AppendLine("Set the capacity of sb2 to 51 characters.")
sb1.Length := 0
sb2.Capacity := 51
sb.AppendLine()
sb.AppendFormat("c1) sb1.Length = {0}, sb1.Capacity = {1}", sb1.Length, sb1.Capacity)
sb.AppendLine()
sb.AppendFormat("c2) sb2.Length = {0}, sb2.Capacity = {1}", sb2.Length, sb2.Capacity)
sb.AppendLine()
sb.AppendFormat("c3) sb1.ToString() = '{0}', sb2.ToString() = '{1}'", sb1.ToString(), sb2.ToString())
sb.AppendLine()
sb.AppendFormat("c4) sb1 equals sb2: {0}", sb1.Equals(sb2) = true?"true":"false")
MsgBox % sb.ToString()
/*
a1) sb1.Length = 3, sb1.Capacity = 16
a2) sb2.Length = 3, sb2.Capacity = 16
a3) sb1.ToString() = 'abc', sb2.ToString() = 'abc'
a4) sb1 equals sb2: true
Ensure sb1 has a capacity of at least 50 characters.
b1) sb1.Length = 3, sb1.Capacity = 50
b2) sb2.Length = 3, sb2.Capacity = 16
b3) sb1.ToString() = 'abc', sb2.ToString() = 'abc'
b4) sb1 equals sb2: false
Set the length of sb1 to zero.
Set the capacity of sb2 to 51 characters.
c1) sb1.Length = 0, sb1.Capacity = 50
c2) sb2.Length = 3, sb2.Capacity = 51
c3) sb1.ToString() = '', sb2.ToString() = 'abc'
c4) sb1 equals sb2: false
*/