ldap_x_utf8_strtok

Find next token in string.

Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap_utf8.h>
  
  char * ldap_x_utf8_strtok (
     char        *str,
     const char  *sep,
     char       **last);
  

Parameters

str

(IN) UTF-8 string to parse. On subsequent calls to this function this parameter should be NULL.

sep

(IN) Set of separator characters.

last

(IN/OUT) After each function call, returns a pointer to the token following the separator character. This value should be passed in to the next function call.

Return Values

Returns a pointer to the next token found in str.

Remarks

Parses a string into tokens based on a set of delimiters. When a delimiter is encountered, it is replaced by a NULL, allowing the token to be processed as a null-terminated string.

On the first call, a value is returned in last. On subsequent calls, NULL should be given for str. Last is updated after each call.

Example

  char utstr[] = { ’a’, 0xe2U, 0x98U, 0xa0U, ’b’, 0xe2U, 0x98U, 0xa0U, ’c’, 0 };
  char delims[] = { 0xe2U, 0x98U, 0xa0U, 0 };
  char *last;
  char *p;
  
  p = ldap_x_utf8_strtok(utstr, delims, &last);       /* p points to "a" */
  p = ldap_x_utf8_strtok(NULL, delims, &last);       /* p points to "b" */
  p = ldap_x_utf8_strtok(NULL, delims, &last);       /* p points to "c" */