Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115197

Offer more options for string comparison

    XMLWordPrintable

Details

    • Epic
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7
    • None
    • Flexible collation
    • All
    • Foundation PM Staging

    Description

      At present, QString offers a choice between case-sensitive and case-insensitive comparison; it also supports a "locale aware" comparison (without a case option).
      Alternatively, comparison can be handled by QCollator, which has the same case choice, can also ignore punctuation differences and operates in a distinct mode for numbers.

      The Unicode collation algorithm has some quite rich structure that can potentially offer several layers of comparison, including whether to take diacritic marks into account as well as the options sketched above. Unicode also offers many space characters; in some situations one should distinguish these, but not always; and sometimes any run of spacing characters should be accepted as equivalent to any other. QString and QCollator should offer a richer vocabulary of options for such choices; this would likely take the form of a richer flags enum replacing Qt::CaseSensitivity.

      Examples of where client code needs such configuration:

      • When the user searches in a document viewer (e.g. PDF, HTML), the UI probably wants to be somewhat forgiving, at least in some locales; but code performing a database integrity validation is likely to require exact matching.
      • French speakers may, for example, neglect to include accents in what they type to search, expecting tete to match tête; while, in contrast, German and Norwegian speakers may consider diacritic marks to matter, so for does not match før and far does not match får (on a Norwegian keyboard, æøå have their own keys).
      • In a UI where the user is invited to type a date or time, the hint text may show them the locale-appropriate format that the input widget is expecting; but the user will see the narrow non-breaking space (for example) as a space and so type space at the relevant point in their input (see QTBUG-114909).

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cnn Qt Core & Network
              Eddy Edward Welbourne
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes