UWIDTH

The UWIDTH function returns an integer value that is equal to the width in bytes of the nth UTF-8 character in a character string argument that is encoded in UTF-8.

The function type is integer.

Format

Read syntax diagramSkip visual syntax diagramFUNCTION UWIDTH(argument-1argument-2 )
argument-1
Must be of class alphabetic or alphanumeric, and it must contain valid UTF-8 data.
argument-2
Must be an integer.

The returned value is an integer.

If argument-2 is not positive or if argument-2 is larger than ULENGTH(argument-1), zero is returned. Otherwise, if argument-2=n, the returned value is the width in bytes of the nth UTF-8 character in argument-1.

If A is an alphanumeric item that contains the UTF-8 value x'4BC3A4666572' ('Käfer'), the returned values are as follows:

  • UWIDTH(A 1) returns 1
  • UWIDTH(A 2) returns 2
  • UWIDTH(A 3) returns 1
  • UWIDTH(A 4) returns 1
  • UWIDTH(A 5) returns 1