The ifx_gl_wcscspn() function

The ifx_gl_wcscspn() function determines the length of a complementary wide-character substring for a wide-character string.

Syntax

#include <ifxgls.h>
...
int ifx_gl_wcscspn(wcs1, wcs1_char_length, wcs2, wcs2_char_length)
       gl_wchar_t *wcs1;
       int wcs1_char_length;
       gl_wchar_t *wcs2;
       int wcs2_char_length;
wcs1
A pointer to the wide-character string to check for the complementary substring of characters in wcs2.
wcs1_char_length
The integer number of characters in the wcs1 string. If wcs1_char_length is the value IFX_GL_NULL, the function assumes that wcs1 is a null-terminated string. For more information about wide-character lengths, see Character-string termination.
wcs2
A pointer to the string of wide-characters to search in wcs1.
wcs2_char_length
The integer number of characters in the wcs2 string. If wcs2_char_length is the value IFX_GL_NULL, the function assumes that wcs2 is a null-terminated string.
Valid in client application Valid in DataBlade® UDR
Yes Yes

Usage

The ifx_gl_wcscspn() function returns the size of the initial substring of wcs1 that does not contain any characters that match characters in wcs2. The initial substring begins at the first character of wcs1. Therefore, this size is the number of characters in wcs1 before the first character that the wcs1 and wcs2 strings have in common. The string of unmatched characters is called the complementary string.

For example, suppose you have the following two wide-character strings, wcs1 and wcs2:
wcs1 = "A1A2B1B2C1C2D1D2A1A2E1E2F1F2A1A2G1G2D1D2";
wcs2 = "F1F2G1D1D2";
With these wide-character strings, the following call to the ifx_gl_wcscspn() function returns 3:
ifx_gl_wcscspn(wcs1, charlen1, wcs2, charlen2)

The first three characters of wcs1 are not in wcs2. The fourth character in wcs1 is D1D2, which is in wcs2 also.

Return values

>=0
The number of characters in the initial substring of wcs1 that consist entirely of wide characters not in the string wcs2.
-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 NULL and sets the ifx_gl_lc_errno() error number to one of the following values.
IFX_GL_PARAMERR
Either wcs1_char_length is not equal to IFX_GL_NULL and is not greater than or equal to 0, or wcs2_char_length is not equal to IFX_GL_NULL and is not greater than or equal to 0.
IFX_GL_TERMMISMAT
Either wcs1_char_length is equal to IFX_GL_NULL, and wcs2_char_length is greater than or equal to 0; or wcs1_char_length is greater than or equal to 0, and wcs2_char_length is equal to IFX_GL_NULL.