1STRSEP(3)                  Linux Programmer's Manual                 STRSEP(3)
2
3
4

NAME

6       strsep - extract token from string
7

SYNOPSIS

9       #include <string.h>
10
11       char *strsep(char **stringp, const char *delim);
12

DESCRIPTION

14       If  *stringp is NULL, the strsep() function returns NULL and does noth‐
15       ing else. Otherwise, this function finds the first token in the  string
16       *stringp,  where  tokens  are delimited by symbols in the string delim.
17       This token is terminated with a  `\0'  character  (by  overwriting  the
18       delimiter) and *stringp is updated to point past the token.  In case no
19       delimiter was found, the  token  is  taken  to  be  the  entire  string
20       *stringp, and *stringp is made NULL.
21

RETURN VALUE

23       The  strsep()  function  returns  a  pointer  to the token, that is, it
24       returns the original value of *stringp.
25

NOTES

27       The strsep() function was introduced as  a  replacement  for  strtok(),
28       since  the  latter  cannot handle empty fields.  However, strtok() con‐
29       forms to C89/C99 and hence is more portable.
30

BUGS

32       This function suffers from the same problems as strtok().  In  particu‐
33       lar, it modifies the original string. Avoid it.
34

CONFORMING TO

36       4.4BSD
37

SEE ALSO

39       index(3),   memchr(3),  rindex(3),  strchr(3),  strpbrk(3),  strspn(3),
40       strstr(3), strtok(3)
41
42
43
44GNU                               1993-04-12                         STRSEP(3)
Impressum