|
|
|
|
- Equivalence between StringCompare and comparison operators
- Comparing numeric values
- Characters taken into account for punctuation and spaces
- StringCompare and UNICODE
StringCompare (Function) In french: ChaîneCompare Compares two strings character by character: - according to the sequence of ASCII characters.
- according to the alphabetical order.
MyString1 is string = "Developing is fantastic" MyString2 is string = "Developing is simple" ResultCompare is int = StringCompare(MyString1, MyString2) // ResultCompare = -1: the character 'f' comes before the character 's'
Syntax
<Result> = StringCompare(<First string> , <Second string> [, <Options>])
<Result>: Integer - 0 if the character strings are equal.
- -1 if the characters in <First string> come before the characters in <Second string> according to the ASCII order or to the lexicographic order.
- 1 if the characters in <First string> come after the characters in <Second string> according to the ASCII order or to the lexicographic order.
<First string>: Character string Character string to compare. <Second string>: Character string Character string to compare. <Options>: Optional constant (or combination of constants) Comparison options: | | ccIgnoreAccent | Compares strings ignoring accented characters. | ccIgnoreCase | Compares strings ignoring the case (uppercase/lowercase characters). | ccIgnoreInsideSpace | Compares strings ignoring spaces within the strings. | ccIgnorePunctuationAndSpace | Compares strings ignoring punctuation and spaces (see Notes for more details). | ccIgnoreSpace | Compares strings ignoring spaces before and after the strings. | ccLexicographicOrder | Compares strings in lexicographical order (for example, 'é' is between 'e' and 'f'). | ccNormal (default value) | Standard comparison, similar to the '=' operator. | ccRespectNumeric | Compares strings taking into account the numeric values within the strings (in this case, "10" comes after "9"). |
Remarks Equivalence between StringCompare and comparison operators - = operator:
The = operator is equivalent to the following code: StringCompare(<String1>, <String2>, ccNormal) - ~= operator:
The ~= operator is equivalent to the following code: StringCompare(<String1>, <String2>, ccIgnoreCasse, + ccIgnoreAccent + ccIgnoreSpace)
This syntax is not available. - ~~ operator:
The ~~ operator is equivalent to the following code: StringCompare(<String1>, <String2>, ccIgnoreCasse + ccIgnoreAccent + ccIgnorePonctuationAndSpace)
This syntax is not available. - <, >, <= and >= operators:
These operators are equivalent to the following code: StringCompare(<String1>, <String2>, ccLexicographicOrder)
This syntax is not available.
Characters taken into account for punctuation and spaces The characters taken into account for punctuation and spaces are provided by the system. To get the list of these characters, write the following WLanguage code:
s is string FOR i = 0 TO 255 IF Charact(i) <> StringFormat(Charact(i), ccIgnorePunctuationAndSpace) THEN Â s += Charact(i) END END Info(s) ToClipboard(s)
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|