The ifx_gl_mbsntsbytes() function

The ifx_gl_mbsntsbytes() function determines the number of bytes in a multibyte string. It ignores trailing spaces.

Syntax

#include <ifxgls.h>
...
int ifx_gl_mbsntsbytes(mbs, mbs_byte_length)
       gl_mchar_t *mbs;
       int mbs_byte_length;
mbs
A pointer to the multibyte-character string whose length the function determines.
mbs_byte_length
The integer number of bytes in the mbs string. If mbs_byte_length is the value IFX_GL_NULL, the function assumes that mbs is a null-terminated string.
Valid in client application Valid in DataBlade® UDR
Yes Yes

Usage

The ifx_gl_mbsntsbytes() function returns the number of bytes in mbs, not including the trailing-space characters. The trailing-space characters are all characters that the blank character class of the current locale defines. For more information about the blank class, see ids_gpg_037.html.

Space characters that are embedded in the string at any place except the end of the string are included in the count. For example, the following call to ifx_gl_mbsntsbytes() returns a value of 10 (the number of bytes in the string A1A2B1B2B3 cd E1, where A1A2 is the multibyte character of 2 bytes, B1B2B3 is the multibyte character of 3 bytes, and E1 is the multibyte character of 1 byte, and s represents a single-byte horizontal white space character):
ifx_gl_mbsntsbytes("A1A2B1B2B3scdsE1ssssss", mbs_byte_length)

Return values

>=0
The number of bytes in the mbs string, not including any trailing space.
-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.
IFX_GL_PARAMERR
The mbs_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to 0.
IFX_GL_EILSEQ
The *mbs value contains an invalid multibyte character.
IFX_GL_EINVAL
The function cannot determine whether the last character of mbs is a valid multibyte character because it would need to read more than mbs_byte_length bytes from mbs.