strsep

Returns the specified substring

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:String Manipulation

Syntax

  #include <string.h>  
   
  int strsep (  
     char        *string,   
     int         *which,
     const char  *source);
  

Parameters

string
(OUT) Points to the returned substring.
which
(IN) Specifies the zero-based substring to return.
source
(IN) Points to the source string for which to return the specified substring.

Return Values

Returns the nth substring. Otherwise, returns a pointer to NULL.

Remarks

The source string must be correctly delimited by a character that does not otherwise occur in the string. The delimiter is assumed to be the first character of the source string. strsep will quit reading the string when it encounters NULL.

You must allocated enough memory to hold the result.

In the following string, "Tue" is the second substring:

  :Sun:Mon:Tue:Wed:Thu:Fri:Sat:
  

See Also

strcmp, strcoll, strncasecmp