Using the ICollation::transform Function

You may want to use the transform function when you are going to compare one string with many other strings, for example, when creating the index for a database.

The result of comparing two transformed strings should be the same as the result of comparing the original strings. For example:

ILocaleKey locale("EN", "UK");

ICollation* order = ICollation::createCollation(locale);

xfmSource = order->transform(sourceString);

xfmTarget = order->transform(targetString);



int oldResult = order->compare(sourceString, targetString);

int newResult = xfmSource.compare(xfmTarget);

if (oldResult == newResult) {

	cout << "Transform succeeded.\n";

} else {

	cout << "Transform did not succeed. \n";

}

delete order


Overview of Locales
Overview of Locale Classes
Locale Names
Collation Classes