Skip to main content
All docs
V24.1

TdxDiacriticStringOptions.ComparisonMode Property

Specifies the active comparison mode for data string search and filter operations.

Declaration

class property ComparisonMode: TdxDiacriticStringComparisonMode read; write; default TdxDiacriticStringComparisonMode.Sensitive;

Property Value

Type Default Description
TdxDiacriticStringComparisonMode Sensitive

The active string comparison mode.

Remarks

All DevExpress data controllers[1] and text field-based editors 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 the changes.

Affected Languages in Automatic Mode

String comparison is diacritic-insensitive only for the following languages if the ComparisonMode property is set to TdxDiacriticStringComparisonMode.Auto:

  • Afrikaans (South Africa)
  • Albanian (Albania)
  • Azerbaijani (Latin, Azerbaijan)
  • Basque (Basque)
  • Bosnian (Latin, Bosnia and Herzegovina)
  • Catalan (Catalan)
  • Croatian (Croatia)
  • Czech (Czech Republic)
  • Danish (Denmark)
  • Dutch (Netherlands)
  • English (United Kingdom)
  • Estonian (Estonia)
  • Finnish (Finland)
  • French (France)
  • Galician (Galician)
  • German (Germany)
  • Greek (Greece)
  • Hungarian (Hungary)
  • Icelandic (Iceland)
  • Irish (Ireland)
  • Italian (Italy)
  • Latvian (Latvia)
  • Lithuanian (Lithuania)
  • Luxembourgish (Luxembourg)
  • Macedonian (Macedonia, FYRO)
  • Maltese (Malta)
  • Norwegian, Bokmål (Norway)
  • Norwegian, Nynorsk (Norway)
  • Polish (Poland)
  • Portuguese (Brazil)
  • Romanian (Romania)
  • Russian (Russia)
  • Serbian (Latin, Serbia)
  • Slovak (Slovakia)
  • Slovenian (Slovenia)
  • Spanish (Spain)
  • Swedish (Sweden)
  • Turkish (Turkey)
  • Ukrainian (Ukraine)
  • Welsh (United Kingdom)

Compatibility String Normalization Mode

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.

Code Example

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.

String Comparison Performance

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 the performance of string comparison operations is critical for your application.

Default Value

The ComparisonMode property’s default value is TdxDiacriticStringComparisonMode.Sensitive.

Footnotes
  1. Except for server mode-based data controllers.

See Also