The ifx_gl_complen() function

The ifx_gl_complen() function determines the length of a collating element.

Syntax

#include <gls.h>
int ifx_gl_complen(gl_lc_t lc, gl_mchar_t *input)
Valid in client application Valid in DataBlade® UDR
Yes Yes

Usage

The ifx_gl_complen() function is used for string scanning. Skipping to the next character in an input string is achieved by calling this function with the current character as an argument and adding to it the return value of the function.

The ifx_gl_complen() function returns the length in bytes of the initial part of an input string that matches a collating element. Multicharacter collation sequences are special sequences of two or more characters that in a specific local take a different meaning. For example in any es_es locale, if the initial part of an input string begins with c or ca, the function returns 0 to indicate that the input string is not a multicharacter collating element. If the initial part of the input string begins with ch, the function returns 2 to indicate that the input string is a multicharacter collating element.

If the ifx_gl_complen() function returns 0, other GLS functions, such as ifx_gl_mbslen(), are required to determine the length of the current character in the input string.

Return values

0
The initial part of the input string is not a multicharacter collating element.
2 and above
The initial part of the input string is a multicharacter collating element
-1
The function was not successful, and the error number is set to indicate the cause. See the Errors section.

Errors

If an error occurred, this function returns -1 and sets the ifx_gl_lc_errno() error number to one of the following values.
GL_INVALIDLOC
An invalid locale is passed to the function.
GL_ENULLPTR
The input is null.
GL_EILSEQ
The input is an invalid character in the locale.
GL_ENOSYS
The operation on locale is invalid.