tango.text.locale.Collation

License:
BSD style:

Version:
Initial release: 2005

author:
John Chapman

class StringComparer;
Compares strings using the specified case and cultural comparision rules.

this(Culture culture, bool ignoreCase);
Creates an instance that compares strings using the rules of the specified culture.

Params:
Culture culture A Culture instance whose rules are used to compare strings.
bool ignoreCase true to perform case-insensitive comparisons; false to perform case-sensitive comparisions.

int compare(const(char)[] strA, const(char)[] strB);
Compares two strings and returns the sort order.

Returns:
-1 is strA is less than strB; 0 if strA is equal to strB; 1 if strA is greater than strB.

Params:
const(char)[] strA A string to compare to strB.
const(char)[] strB A string to compare to strA.

bool equals(const(char)[] strA, const(char)[] strB);
Indicates whether the two strings are equal.

Returns:
true if strA and strB are equal; otherwise, false.

Params:
const(char)[] strA A string to compare to strB.
const(char)[] strB A string to compare to strA.

static StringComparer currentCulture();
Property. Retrieves an instance that performs case-sensitive comparisons using the rules of the current culture.

Returns:
A new StringComparer instance.

static StringComparer currentCultureIgnoreCase();
Property. Retrieves an instance that performs case-insensitive comparisons using the rules of the current culture.

Returns:
A new StringComparer instance.

static StringComparer invariantCulture();
Property. Retrieves an instance that performs case-sensitive comparisons using the rules of the invariant culture.

Returns:
A new StringComparer instance.

static StringComparer invariantCultureIgnoreCase();
Property. Retrieves an instance that performs case-insensitive comparisons using the rules of the invariant culture.

Returns:
A new StringComparer instance.

alias StringComparison;
Delegate. Represents the method that will handle the string comparison.

Remarks:
The delegate has the signature int delegate(const(char)[], const(char)[]).

class StringSorter;
Sorts strings according to the rules of the specified culture.

this(StringComparer comparer = null);
Creates an instance using the specified StringComparer.

Params:
StringComparer comparer The StringComparer to use when comparing strings. Optional.

this(int delegate(const(char)[], const(char)[]) comparison);
Creates an instance using the specified delegate.

Params:
int delegate(const(char)[], const(char)[]) comparison The delegate to use when comparing strings.

Remarks:
The comparison parameter must have the same signature as StringComparison.

inout(void) sort(ref inout(char)[][] array);
Sorts all the elements in an array.

Params:
inout(char)[][] array The array of strings to sort.

inout(void) sort(ref inout(char)[][] array, size_t index, size_t count);
Sorts a range of the elements in an array.

Params:
inout(char)[][] array The array of strings to sort.
size_t index The starting index of the range.
size_t count The number of elements in the range.

static @property StringSorter currentCulture();
Property. Retrieves an instance that performs a case-sensitive sort using the rules of the current culture.

Returns:
A StringSorter instance.

static @property StringSorter currentCultureIgnoreCase();
Property. Retrieves an instance that performs a case-insensitive sort using the rules of the current culture.

Returns:
A StringSorter instance.

static StringSorter invariantCulture();
Property. Retrieves an instance that performs a case-sensitive sort using the rules of the invariant culture.

Returns:
A StringSorter instance.

static StringSorter invariantCultureIgnoreCase();
Property. Retrieves an instance that performs a case-insensitive sort using the rules of the invariant culture.

Returns:
A StringSorter instance.


Page generated by Ddoc. Copyright (c) 2005 John Chapman. All rights reserved