Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8strchr.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8strchr.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8strchr.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8strchr.html on line 8

utf8strchr()

Search for a UTF-8 character in a string

Synopsis:

#include <utf8.h>

char * utf8strchr( char const *string, 
                   char const *mbchar, 
                   int *count );

Arguments:

string
A pointer to the string to search.
mbchar
The character to look for.
count
A pointer to the location where utf8strchr() stores the number of UTF-8 characters the matching character is from the start of the string.

Library:

ph

Description:

The utf8strchr() function searches for a character in string that matches mbchar. If such a match occurs in string, count (if provided) is set to the number of UTF-8 characters the matching character is from the beginning of the string. For example, if mbchar matches the first character in string, count is set to 0. If mbchar matches the second character in string, count is set to 1.

A pointer to the beginning of the matching character within string is returned. If no match is found, the function returns NULL and doesn't change count.

Returns:

A pointer to the matching character, if found, or NULL if not found

Examples:

#include <Pt.h>

int main()
  {
  char string[] = "Hello there: äîòéü found"; 
  char mbchar[] = "é";
  int count;
  char *p;

  if( (p = utf8strchr( string, mbchar, &count ) ) )
    printf( 
      "Character found: character offset %d\n byte offset %d.\n",
      count, p - string );
  else
    printf( "Not found.\n" );
  return EXIT_SUCCESS;
  }

Classification:

Photon

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

utf8strichr(), utf8strnchr(), utf8strnichr(), utf8strrchr(), utf8strirchr()

Unicode Multilingual Support in the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8strchr.html on line 158

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/utf8/utf8strchr.html on line 158