| Package | vegas.util.comparators |
| Class | public class StringComparator |
| Inheritance | StringComparator CoreObject |
| Implements | ICloneable, IComparator, ICopyable |
Example :
import vegas.util.comparators.StringComparator ; var comp1:StringComparator = new StringComparator() ; var comp2:StringComparator = new StringComparator(true) ; // ignore case var s0:String = "HELLO" ; var s1:String = "hello" ; var s2:String = "welcome" ; var s3:String = "world" ; trace( comp1.compare(s1, s2) ) ; -1 trace( comp1.compare(s2, s1) ) ; 1 trace( comp1.compare(s1, s3) ) ; -1 trace( comp1.compare(s1, s1) ) ; 0 trace( comp1.compare(s1, s0) ) ; -1 trace( comp2.compare(s1, s0) ) ; 0
| Property | Defined by | ||
|---|---|---|---|
| ignoreCase : Boolean
Allow to take into account the case for comparison.
| StringComparator | ||
| Method | Defined by | ||
|---|---|---|---|
|
StringComparator(ignoreCase:Boolean = false)
Creates a new StringComparator instance.
| StringComparator | ||
|
clone():*
Creates and returns a shallow copy of the object.
| StringComparator | ||
|
compare(o1:*, o2:*):int
Returns an integer value to compare two String objects.
| StringComparator | ||
|
copy():*
Creates and returns a deep copy of the object.
| StringComparator | ||
|
[static]
Returns the
StringComparator singleton with the a true ignoreCase property. | StringComparator | ||
![]() |
Returns the internal
ILogger reference of this ILogable object. | CoreObject | |
|
[static]
Returns the
StringComparator singleton with the a false ignoreCase property. | StringComparator | ||
![]() |
hashCode():uint
Returns a hashcode value for the object.
| CoreObject | |
![]() |
Sets the internal
ILogger reference of this ILogable object. | CoreObject | |
|
toSource(indent:int = 0):String
Returns a Eden representation of the object.
| StringComparator | ||
![]() |
toString():String
Returns the string representation of this instance.
| CoreObject | |
| ignoreCase | property |
public var ignoreCase:BooleanAllow to take into account the case for comparison.
| StringComparator | () | constructor |
public function StringComparator(ignoreCase:Boolean = false)Creates a new StringComparator instance.
ParametersignoreCase:Boolean (default = false) — a boolean to define if the comparator ignore case or not.
|
| clone | () | method |
public function clone():*Creates and returns a shallow copy of the object.
Returns* — A new object that is a shallow copy of this instance.
|
| compare | () | method |
public function compare(o1:*, o2:*):intReturns an integer value to compare two String objects.
Parameterso1:* — the first String object to compare.
|
|
o2:* — the second String object to compare.
|
int —
|
— if compare(a, b) and 'a' or 'b' aren't String objects.
|
| copy | () | method |
public function copy():*Creates and returns a deep copy of the object.
Returns* — A new object that is a deep copy of this instance.
|
| getIgnoreCaseStringComparator | () | method |
public static function getIgnoreCaseStringComparator():IComparator
Returns the StringComparator singleton with the a true ignoreCase property.
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple StringComparators may be used in the same application.
IComparator —
the StringComparator singleton with the a true ignoreCase property.
|
| getStringComparator | () | method |
public static function getStringComparator():IComparator
Returns the StringComparator singleton with the a false ignoreCase property.
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple StringComparators may be used in the same application.
IComparator —
the StringComparator singleton with the a false ignoreCase property.
|
| toSource | () | method |
public override function toSource(indent:int = 0):StringReturns a Eden representation of the object.
Parametersindent:int (default = 0) |
String — a string representation the source code of the object.
|