Compare String values
OutputVar := MfString.Compare(objParams)
OutputVar := MfString.Compare(strA, strB)
OutputVar := MfString.Compare(strA, strB, ignoreCase)
OutputVar := MfString.Compare(strA, strB, comparisonType)
OutputVar := MfString.Compare(strA, indexA, strB, indexB, length)
OutputVar := MfString.Compare(strA, indexA, strB, indexB, length, ignoreCase)
Compares two string base up the Parameters passed into the MfParams object.
objParams
as instance of MfParams can be a valid combination of the MfParams below.
Static Method
objParams := new MfParams()
objParams.AllowEmptyString := true
objParams.AddString("This is my first string")
objParams.AddString("This is my second string")
Msgbox % MfString.Compare(objParams) ; displays 1
Compares two specified MfString objects and returns an Integer that indicates their relative position in the sort order.
strA
The first string to compare. Can be instance of MfString or var containing string
strB
The second string to compare. Can be instance of MfString or var containing string
Static Method
This Overload ignores case unless StringCaseSense has be turned On.
strFirst := "This is my first string"
strSecond := "This is my second string"
strObjFirst := new MfString(strFirst)
strObjSecond := new MfString(strSecond)
; can pass in vars of string
Msgbox % MfString.Compare(strFirst, strSecond) ; displays 1
; can pass in MfString instances
Msgbox % MfString.Compare(strObjFirst, strObjSecond) ; displays 1
; can pass in var of string mixed with MfString instance
Msgbox % MfString.Compare(strFirst, strObjSecond) ; displays 1
Compares two specified MfString objects, ignoring or honoring their case, and returns an Integer that indicates their relative position in the sort order.
strA
The first string to compare. Can be instance of MfString or var containing string
strB
The second string to compare. Can be instance of MfString or var containing string
ignoreCase
true to ignore case during the comparison; otherwise, false.
Can be instance of MfBool or var containing boolean.
Static Method
strFirst := "Hello World"
strSecond := "hello world"
strObjFirst := new MfString(strFirst)
strObjSecond := new MfString(strSecond)
Msgbox % MfString.Compare(strObjFirst, strObjSecond, MfBool.TrueObj) ; displays 0
Msgbox % MfString.Compare(strFirst, strSecond, false) ; displays -32
Compares two specified MfString objects using the specified rules, and returns an Integer that indicates their relative position in the sort order.
strA
The first string to compare. Can be instance of MfString or var containing string
strB
The second string to compare. Can be instance of MfString or var containing string
comparisonType
One of the MfStringComparison enumeration values that specifies the rules to use in the comparison.
Can be MfStringComparison instance or MfStringComparison.Instance.EnumItem
Static Method
strFirst := "Hello World"
strSecond := "hello world"
MyOpt := new MfStringComparison(MfStringComparison.Instance.OrdinalIgnoreCase)
Msgbox % MfString.Compare(strFirst, strSecond, MyOpt) ; displays 0
Msgbox % MfString.Compare(strFirst, strSecond, MfStringComparison.Instance.Ordinal) ; displays -32
Compares substrings of two specified MfString objects and returns an Integer that indicates their relative position in the sort order.
strA
The first string to compare. Can be instance of MfString or var containing string
indexA
The zero-based position of the substring within strA.
Can be MfInteger instance or var containing integer.
strB
The second string to compare. Can be instance of MfString or var containing string
indexB
The zero-based position of the substring within strB.
Can be MfInteger instance or var containing integer.
length
The maximum number of characters in the substrings to compare.
Can be MfInteger instance or var containing integer.
Static Method
If length is greater then the availbale characters of strA or strB then the number of remaing characters is used. This prevents a error from being thrown if length is to high.
This Overload ignores case unless StringCaseSense has be turned On.
strFirst := "Color Orange Fruit"
strSecond := "Color Green fruit"
intIndex := 0
intLength := 6
strObjFirst := new MfString(strFirst)
strObjSecond := new MfString(strSecond)
; in the next line the compare is comparing "Color " and "Color "
Msgbox % MfString.Compare(strFirst, intIndex, strSecond, intIndex, intLength) ; displays 0
intIndex := 6
intLength := 20
; in the next line the compare is comparing "Orange Friut" and "Green fruit"
; intLength is longer than strA or strB but will self correct
Msgbox % MfString.Compare(strObjFirst, intIndex, strObjSecond, intIndex, intLength) ; displays 8
intLength := 5
; in the next line the compare is comparing "Fruit" and "fruit"
Msgbox % MfString.Compare(strFirst, 13, strSecond, 12, intLength) ; displays 0
Compares substrings of two specified MfString objects, ignoring or honoring their case, and returns an Integer that indicates their relative position in the sort order.
strA
The first string to compare. Can be instance of MfString or var containing string
indexA
The zero-based position of the substring within strA.
Can be MfInteger instance or var containing integer.
strB
The second string to compare. Can be instance of MfString or var containing string
indexB
The zero-based position of the substring within strB.
Can be MfInteger instance or var containing integer.
length
The maximum number of characters in the substrings to compare.
Can be MfInteger instance or var containing integer.
ignoreCase
true to ignore case during the comparison; otherwise, false.
Can be instance of MfBool or var containing boolean.
Static Method
If length is greater then the availbale characters of strA or strB then the number of remaing characters is used. This prevents a error from being thrown if length is to high.
strFirst := "Color Orange Fruit"
strSecond := "Color Green fruit"
intIndex := 0
intLength := 6
strObjFirst := new MfString(strFirst)
strObjSecond := new MfString(strSecond)
; in the next line the compare is comparing "Color " and "Color "
Msgbox % MfString.Compare(strFirst, intIndex, strSecond, intIndex, intLength, true) ; displays 0
intIndex := 6
intLength := 20
; in the next line the compare is comparing "Orange Friut" and "Green fruit"
; intLength is longer than strA or strB but will self correct
Msgbox % MfString.Compare(strObjFirst, intIndex, strObjSecond, intIndex, intLength, true) ; displays 8
intLength := 5
; in the next line the compare is comparing "Fruit" and "fruit"
Msgbox % MfString.Compare(strFirst, 13, strSecond, 12, intLength, false) ; displays -32
Msgbox % MfString.Compare(strFirst, 13, strSecond, 12, intLength, true) ; displays 0
Returns a var containing Integer that indicates the lexical relationship between the two comparands. Value Condition Less than zero strA is less than strB. Zero strA equals strB. Greater than zero strA is greater than strB.
Method is not affected by the state of ReturnAsObject and always returns a var containing an Integer.
Throws MfArgumentException if the incorrect number or type of parameters are passed in.
Throws MfNotSupportedException if Overloads can not match Parameters.