Equals()

Namespace ›› System ›› MfString ›› Methods ››
Parent Previous Next

Equals()

Overrides MfObject.Equals()

OutputVar := instance.Equals(strA)
OutputVar := MfString.Equals(strA, strB)

Equals(strA)

Gets if an instance of MfString equals strA. See example 1.

Parameters

strA

The string to compare to the current instance.
Can instance of MfString or var of string.

Equals(strA, strB)

Static Method
Gets if an strA equals strB. See example 2.

Parameters

strA

The string to compare to strB.
Can instance of MfString or var of string.

strB

The string to compare to objA.
Can instance of MfString or var of string.

Returns

Returns var Boolean value of true if the objects are the same; otherwise false.

Throws

Throws MfArgumentNullException if objA is null.
Throws MfArgumentException if parameters are not MfString instance.
Throws MfNullReferenceException if objB is absent and current instance is null.

Remarks

Method is not affected by the state of ReturnAsObject and will always return a var containing a boolean value if no errors are thrown.
Case sensitive method.
This method obeys the IgnoreCase for Instances of MfString. If using MfString.Equals(strA, strB) static method then method will be case sensitive if StringCaseSense has be turned On.; Otherwise MfString.Equals(strA, strB) static method is NOT case sensitive.

Example 1

mfs1 := new MfString("Hello World")
mfs2 := new MfString("Hello World")
result := mfs1.Equals(mfs2) ; result will be true

Example 2

mfs1 := new MfString("hello World")
mfs2 := new MfString("Hello World")
result := MfString.Equals(mfs1, mfs2)
; result will be true because StringCaseSense has not been turned on

Example 3

mfs1 := new MfString("Hello World ")
mfs2 := new MfString("Hello World")
result := mfs1.Equals(mfs2) ; result will be false because mfs1 has a space at the end

Example 4

mfs1 := new MfString("Hello World")
mfs1.IgnoreCase := false
result := mfs1.Equals("hello world") ; result will be fasle because IgnoreCase is false

Related

EndsWith()
StartsWith()
Difference()