summaryrefslogtreecommitdiffstats
path: root/man3/string.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/string.3')
-rw-r--r--man3/string.3224
1 files changed, 224 insertions, 0 deletions
diff --git a/man3/string.3 b/man3/string.3
new file mode 100644
index 0000000..dc1c415
--- /dev/null
+++ b/man3/string.3
@@ -0,0 +1,224 @@
+.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\" References consulted:
+.\" Linux libc source code
+.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
+.\" 386BSD man pages
+.\" Modified Sun Jul 25 10:54:31 1993, Rik Faith (faith@cs.unc.edu)
+.TH string 3 2023-01-22 "Linux man-pages 6.05.01"
+.SH NAME
+stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn,
+strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk,
+strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex
+\- string operations
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.B #include <strings.h>
+.TP
+.BI "int strcasecmp(const char *" s1 ", const char *" s2 );
+Compare the strings
+.I s1
+and
+.I s2
+ignoring case.
+.TP
+.BI "int strncasecmp(const char " s1 [. n "], const char " s2 [. n "], \
+size_t " n );
+Compare the first
+.I n
+bytes of the strings
+.I s1
+and
+.I s2
+ignoring case.
+.TP
+.BI "char *index(const char *" s ", int " c );
+Identical to
+.BR strchr (3).
+.TP
+.BI "char *rindex(const char *" s ", int " c );
+Identical to
+.BR strrchr (3).
+.TP
+.B #include <string.h>
+.TP
+.BI "char *stpcpy(char *restrict " dest ", const char *restrict " src );
+Copy a string from
+.I src
+to
+.IR dest ,
+returning a pointer to the end of the resulting string at
+.IR dest .
+.TP
+.BI "char *strcat(char *restrict " dest ", const char *restrict " src );
+Append the string
+.I src
+to the string
+.IR dest ,
+returning a pointer
+.IR dest .
+.TP
+.BI "char *strchr(const char *" s ", int " c );
+Return a pointer to the first occurrence of the character
+.I c
+in the string
+.IR s .
+.TP
+.BI "int strcmp(const char *" s1 ", const char *" s2 );
+Compare the strings
+.I s1
+with
+.IR s2 .
+.TP
+.BI "int strcoll(const char *" s1 ", const char *" s2 );
+Compare the strings
+.I s1
+with
+.I s2
+using the current locale.
+.TP
+.BI "char *strcpy(char *restrict " dest ", const char *restrict " src );
+Copy the string
+.I src
+to
+.IR dest ,
+returning a pointer to the start of
+.IR dest .
+.TP
+.BI "size_t strcspn(const char *" s ", const char *" reject );
+Calculate the length of the initial segment of the string
+.I s
+which does not contain any of bytes in the string
+.IR reject ,
+.TP
+.BI "char *strdup(const char *" s );
+Return a duplicate of the string
+.I s
+in memory allocated using
+.BR malloc (3).
+.TP
+.BI "char *strfry(char *" string );
+Randomly swap the characters in
+.IR string .
+.TP
+.BI "size_t strlen(const char *" s );
+Return the length of the string
+.IR s .
+.TP
+.nf
+.BI "char *strncat(char " dest "[restrict strlen(." dest ") + ." n " + 1],"
+.BI " const char " src "[restrict ." n ],
+.BI " size_t " n );
+.fi
+Append at most
+.I n
+bytes from the unterminated string
+.I src
+to the string
+.IR dest ,
+returning a pointer to
+.IR dest .
+.TP
+.BI "int strncmp(const char " s1 [. n "], const char " s2 [. n "], size_t " n );
+Compare at most
+.I n
+bytes of the strings
+.I s1
+and
+.IR s2 .
+.TP
+.BI "char *strpbrk(const char *" s ", const char *" accept );
+Return a pointer to the first occurrence in the string
+.I s
+of one of the bytes in the string
+.IR accept .
+.TP
+.BI "char *strrchr(const char *" s ", int " c );
+Return a pointer to the last occurrence of the character
+.I c
+in the string
+.IR s .
+.TP
+.BI "char *strsep(char **restrict " stringp ", const char *restrict " delim );
+Extract the initial token in
+.I stringp
+that is delimited by one of the bytes in
+.IR delim .
+.TP
+.BI "size_t strspn(const char *" s ", const char *" accept );
+Calculate the length of the starting segment in the string
+.I s
+that consists entirely of bytes in
+.IR accept .
+.TP
+.BI "char *strstr(const char *" haystack ", const char *" needle );
+Find the first occurrence of the substring
+.I needle
+in the string
+.IR haystack ,
+returning a pointer to the found substring.
+.TP
+.BI "char *strtok(char *restrict " s ", const char *restrict " delim );
+Extract tokens from the string
+.I s
+that are delimited by one of the bytes in
+.IR delim .
+.TP
+.nf
+.BI "size_t strxfrm(char " dest "[restrict ." n "], \
+const char " src "[restrict ." n ],
+.BI " size_t " n );
+.fi
+Transforms
+.I src
+to the current locale and copies the first
+.I n
+bytes to
+.IR dest .
+.SS Obsolete functions
+.TP
+.nf
+.BI "char *strncpy(char " dest "[restrict ." n "], \
+const char " src "[restrict ." n ],
+.BI " size_t " n );
+.fi
+Copy at most
+.I n
+bytes from string
+.I src
+to
+.IR dest ,
+returning a pointer to the start of
+.IR dest .
+.SH DESCRIPTION
+The string functions perform operations on null-terminated
+strings.
+See the individual man pages for descriptions of each function.
+.SH SEE ALSO
+.BR bstring (3),
+.BR stpcpy (3),
+.BR strcasecmp (3),
+.BR strcat (3),
+.BR strchr (3),
+.BR strcmp (3),
+.BR strcoll (3),
+.BR strcpy (3),
+.BR strcspn (3),
+.BR strdup (3),
+.BR strfry (3),
+.BR strlen (3),
+.BR strncasecmp (3),
+.BR strncat (3),
+.BR strncmp (3),
+.BR strncpy (3),
+.BR strpbrk (3),
+.BR strrchr (3),
+.BR strsep (3),
+.BR strspn (3),
+.BR strstr (3),
+.BR strtok (3),
+.BR strxfrm (3)