Max_(A: String; B: String): String;
A. The first string to compare.
B. The second string to compare.
The Max_ method compares two strings character-by-character and returns the maximum one of them.
Strings are compared by value of the ASCII case-sensitive encoding. For example:
When comparing the abcde and abc string, the first string will be the maximum one. The first string length is greater than length of the second one.
When comparing the Abc and abc strings, the first string will be the maximum one. The ASCII encoding value for the A character is greater than for a.
The method returns Null if at least one of parameters is equal to Null.
Sub UserProc;
Var
s1, s2, s3: String;
Begin
s1 := "Apple";
s2 := "Banana";
// Get the maximum string of two strings
s3 := String.Max_(s1, s2);
Debug.WriteLine("Max_(""" + s1 + """" + ", """ + s2 + """" + ") = " + s3);
End Sub UserProc
After executing the example the maximum string of the Apple and Banana strings is displayed in the console window.
See also: