Internationalization and localization tools


Locale-Sensitive C/C++ String Operation Function

char *strchr(const char *string, int c);

char *index(const char *string, int c);

wchar_t *wcschr(const wchar_t *string, wchar_t c);

unsigned char *_mbschr(unsigned char *string, unsigned int c);

_TXCHAR *_tcschr(_TXCHAR *string, _TINT c);

Internationalization (I18n) Function Overview

The strchr function returns a pointer to the first occurrence of c in string, or NULL if c is not found.

wcschr is the wide version of the function; its parameters and return are wide character strings.

_mbschr is supported only on Windows platforms and is the multibyte version of the function; its parameters and return are multibyte character strings.

_tcschr is the Windows-only Generic version of strchr; with the _MBCS or _UNICODE compiler flags determining its mapping to either _mbschr or wcschr.

The index function is the BSD name for strchr. Use strchr instead.

I18n Issues

Use the appropriate version of the function as required for internationalization support.

For Windows MBCS platforms, ensure that the multibyte code page is set properly, as _mbschr depends on it. By default, the multibyte code page is set to the system-default ANSI code page obtained from the operating system at program startup. Use _getmbcp and _setmbcp to query or change the current multibyte code page, respectively.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Locale-Sensitive C/C++ String Operation Functions

 

Lingoport internationalization and localization services and software