vcl-dxcore-dot-tdxdiacriticstringoptions.md
Specifies the active comparison mode for data string search and filter operations.
class property ComparisonMode: TdxDiacriticStringComparisonMode read; write; default TdxDiacriticStringComparisonMode.Sensitive;
| Type | Default | Description |
|---|---|---|
| TdxDiacriticStringComparisonMode | Sensitive |
The active string comparison mode.
|
All DevExpress data controllers[1] and text field-based editors[2] can interpret characters with different diacritic marks as different characters (default) or as the same character.
You can set the ComparisonMode property to TdxDiacriticStringComparisonMode.Insensitive or TdxDiacriticStringComparisonMode.Auto to treat all variations of the same letter in an alphabet as the same character for string comparison.
Tip
We recommend that you configure string comparison settings in the initialization section of the main application as demonstrated in the code example below. If you need to change these settings while the application is running, refresh all data controllers to apply your changes.
String comparison is diacritic-insensitive only for the following languages if the ComparisonMode property is set to TdxDiacriticStringComparisonMode.Auto:
The built-in DevExpress string normalization algorithm for diacritic-insensitive string comparison is up to 3 times faster than the system NormalizationKD implementation and handles the majority of languages correctly.
If diacritic-insensitive string comparison yields incorrect results for the target language, you can set the NormalizationMode property to TdxDiacriticStringNormalizationMode.System to achieve correct results at the cost of slower string comparison operations.
The following code example configures global diacritic mark-related settings at application startup:
uses
dxCore;
// ...
begin
TdxDiacriticStringOptions.ComparisonMode := TdxDiacriticStringComparisonMode.Insensitive;
TdxDiacriticStringOptions.NormalizationMode := TdxDiacriticStringNormalizationMode.System;
// ...
Application.Initialize;
Application.MainFormOnTaskBar := True;
Application.CreateForm(TMyForm, MyForm);
Application.Run;
end.
#include <vcl.h>
#include "dxCore.hpp"
#pragma hdrstop
#include <tchar.h>
//-------------------------------------------------------------------------------
USEFORM("Unit1.cpp", TMyForm);
//-------------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
try
{
TdxDiacriticStringOptions::ComparisonMode = TdxDiacriticStringComparisonMode::Insensitive;
TdxDiacriticStringOptions::NormalizationMode = TdxDiacriticStringNormalizationMode::System;
// ...
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TMyForm), &MyForm);
Application->Run();
}
// ...
}
Compared to the default string comparison mode, diacritic-insensitive string normalization and comparison algorithms are more time-consuming. We recommend that you use the default mode if string comparison performance is critical for your application.
Diacritic mark settings have no effect on server mode data controllers and the following lookup editors:
TcxExtLookupComboBoxAn unbound lookup combo box editor that displays a data-aware Table or Banded Table grid View as its drop-down window.TcxDBExtLookupComboBoxA data-aware lookup combo box editor that displays a data-aware Table or Banded Table grid View in its drop-down window.TcxDBLookupComboBoxA data-aware lookup combo box editor.TcxLookupComboBoxAn unbound lookup combo box editor.
Tip
You can use database collation options instead of these global diacritic settings if you use Server Mode.
Available database collation options depend on the SQL server you use. Refer to the corresponding SQL server documentation for details (for example, Collation and Unicode Support in Microsoft SQL Server).
The ComparisonMode property’s default value is TdxDiacriticStringComparisonMode.Sensitive.
Footnotes
Except for server mode-based data controllers.
Except for lookup editors.
See Also
TdxDiacriticStringOptions.NormalizationMode Property
TdxDiacriticStringOptions Class