Package | org.as3coreaddendum.system.comparators |
Class | public class StringComparator |
Inheritance | StringComparator ![]() |
Implements | IComparator |
String
objects.
Property | Defined By | ||
---|---|---|---|
stringCase : StringCase
Defines whether case is considered in the comparison. | StringComparator |
Method | Defined By | ||
---|---|---|---|
StringComparator(stringCase:StringCase)
Constructor, creates a new StringComparator object. | StringComparator | ||
compare(o1:*, o2:*):int
Performs the comparison between the two arguments. | StringComparator | ||
toString():String
Returns the string representation of this object. | StringComparator |
stringCase | property |
stringCase:StringCase
Defines whether case is considered in the comparison.
public function get stringCase():StringCase
public function set stringCase(value:StringCase):void
StringComparator | () | Constructor |
public function StringComparator(stringCase:StringCase)
Constructor, creates a new StringComparator
object.
stringCase:StringCase — Indicates whether case sensitivity is considered or not in the comparison.
|
compare | () | method |
public function compare(o1:*, o2:*):int
Performs the comparison between the two arguments.
Parameters
o1:* — The first String object to be compared.
| |
o2:* — The second String object to be compared.
|
int — A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
|
ArgumentError — if any of the arguments is null .
|
toString | () | method |
public function toString():String
Returns the string representation of this object.
ReturnsString — the string representation of the this object.
|
import org.as3coreaddendum.system.comparators.StringComparator; var c1:StringComparator = new StringComparator(); c1.compare("comparison", "between"); // 1 c1.compare("between", "comparison"); // -1 c1.compare("between", "strings"); // 1 c1.compare("strings", "between"); // -1 c1.compare("STRINGS", "strings"); // 1 c1.compare("strings", "Strings"); // -1 c1.compare("strings", "strings"); // 0 var c2:StringComparator = new StringComparator(false); c2.compare("STRINGS", "strings"); // 0 c2.compare("strings", "Strings"); // 0 c2.compare("between", "strings"); // 1