_mbsspnp, _mbsspnp_l, _strspnp, _wcsspnp
Returns a pointer to the first character in a given string that is not in another given string.
unsigned char *_mbsspnp(
const unsigned char *str,
const unsigned char *charset
);
unsigned char *_mbsspnp_l(
const unsigned char *str,
const unsigned char *charset,
_locale_t locale
);
char *_strspnp(
const char *str,
const char *charset
);
wchar_t *_wcsspnp(
const unsigned wchar_t *str,
const unsigned wchar_t *charset
);
Parameters
str
Null-terminated string to search.charset
Null-terminated character set.locale
Locale to use.
Return Value
_strspnp, _wcsspnp, and _mbsspnp return a pointer to the first character in str that does not belong to the set of characters in charset*.* Each of these functions returns NULL if str consists entirely of characters from charset*.* For each of these routines, no return value is reserved to indicate an error.
Remarks
The _mbsspnp function returns a pointer to the multibyte character that is the first character in str that does not belong to the set of characters in charset. _mbsspnp recognizes multibyte-character sequences according to the multibyte code page currently in use. The search does not include terminating null characters.
If either str or charset is a null pointer, this function invokes the invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, the function returns NULL and sets errno to EINVAL.
Generic-Text Routine Mappings
Tchar.h routine |
_UNICODE and _MBCS not defined |
_MBCS defined |
_UNICODE defined |
---|---|---|---|
_tcsspnp |
_strspnp |
_mbsspnp |
_wcsspnp |
_strspnp and _wcsspnp are single-byte character and wide-character versions of _mbsspnp. _strspnp and _wcsspnp behave identically to _mbsspnp otherwise; they are provided only for this mapping and should not be used for any other reason. For more information, see Using Generic-Text Mappings and Generic-Text Mappings.
_mbsspnp_lis identical except that it uses the locale parameter passed in instead. For more information, see Locale.
Requirements
Routine |
Required header |
---|---|
_mbsspnp |
<mbstring.h> |
_strspnp |
<tchar.h> |
_wcsspnp |
<tchar.h> |
For more compatibility information, see Compatibility in the Introduction.
Example
// crt_mbsspnp.c
#include <mbstring.h>
#include <stdio.h>
int main( void ) {
const unsigned char string1[] = "cabbage";
const unsigned char string2[] = "c";
unsigned char *ptr = 0;
ptr = _mbsspnp( string1, string2 );
printf( "%s\n", ptr);
}
Output
abbage
.NET Framework Equivalent
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.
See Also
Concepts
Interpretation of Multibyte-Character Sequences
strspn, wcsspn, _mbsspn, _mbsspn_l
strncat, _strncat_l, wcsncat, wcsncat_l, _mbsncat _mbsncat_l
strncmp, wcsncmp, _mbsncmp, _mbsncmp_l
strncpy, _strncpy_l, wcsncpy, _wcsncpy_l, _mbsncpy, _mbsncpy_l
_strnicmp, _wcsnicmp, _mbsnicmp, _strnicmp_l, _wcsnicmp_l, _mbsnicmp_l