Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-11362

Add multi-byte aware string functions

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • Trinity
    • Trinity
    • query
    • None
    • DOC-2023-S25
    • 0

    Description

      New multi-byte character aware versions of:{{ length, lpad, rpad, substr }}and{{ position}} have been added.  They are all prefixed with "MB_".  The multi-byte character aware functions return/accept character counts/positions rather than byte values.

      (All variants of SUBSTR & POSITION exist - MB_SUBSTR, MB_SUBSTR0, MB_SUBSTR1, MB_POSITION, MB_POSITION0, MB_POS0, MB_POSITION1, MB_POS1 - though I note we don't document other than the base variants.)

      They should be added under https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/stringfun.html and should be referenced in the documentation for their byte-wise counterparts.  e.g. https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/stringfun.html#fn-str-substr should have the descriptions for start_pos and length enhanced to note "This is in bytes not characters" and the overall entry should  contain a note to the effect "A character-based variant of this function is MB_SUBSTR."   (or similar)

      The MB_ variants should note that they will be slower than their byte-wise counterparts.

      Attachments

        Issue Links

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

          Activity

            People

              simon.dew Simon Dew
              Donald.haggart Donald Haggart
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty