CINXE.COM

string

<html> <head> <title>string</title> <META NAME="KEYWORDS" CONTENT="string"> </head> <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#0000ff" ALINK="#0000ff" TEXT="#000000"> <center> <h1><b>string</b></h1></center> <PRE> <STRONG><A HREF="/man3/STRING">STRING(3)</A></STRONG> Linux Programmer's Manual <STRONG><A HREF="/man3/STRING">STRING(3)</A></STRONG> NAME stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn, strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strp- brk, strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex - string operations SYNOPSIS #include &lt;strings.h&gt; int strcasecmp(const char *s1, const char *s2); Compare the strings s1 and s2 ignoring case. int strncasecmp(const char *s1, const char *s2, size_t n); Compare the first n bytes of the strings s1 and s2 ignoring case. char *index(const char *s, int c); Return a pointer to the first occurrence of the character c in the string s. char *rindex(const char *s, int c); Return a pointer to the last occurrence of the character c in the string s. #include &lt;string.h&gt; char *stpcpy(char *dest, const char *src); Copy a string from src to dest, returning a pointer to the end of the resulting string at dest. char *strcat(char *dest, const char *src); Append the string src to the string dest, returning a pointer dest. char *strchr(const char *s, int c); Return a pointer to the first occurrence of the character c in the string s. int strcmp(const char *s1, const char *s2); Compare the strings s1 with s2. int strcoll(const char *s1, const char *s2); Compare the strings s1 with s2 using the current locale. char *strcpy(char *dest, const char *src); Copy the string src to dest, returning a pointer to the start of dest. size_t strcspn(const char *s, const char *reject); Calculate the length of the initial segment of the string s which does not contain any of bytes in the string reject, char *strdup(const char *s); Return a duplicate of the string s in memory allocated using <STRONG><A HREF="/man3/malloc">malloc(3)</A></STRONG>. char *strfry(char *string); Randomly swap the characters in string. size_t strlen(const char *s); Return the length of the string s. char *strncat(char *dest, const char *src, size_t n); Append at most n bytes from the string src to the string dest, returning a pointer to dest. int strncmp(const char *s1, const char *s2, size_t n); Compare at most n bytes of the strings s1 and s2. char *strncpy(char *dest, const char *src, size_t n); Copy at most n bytes from string src to dest, returning a pointer to the start of dest. char *strpbrk(const char *s, const char *accept); Return a pointer to the first occurrence in the string s of one of the bytes in the string accept. char *strrchr(const char *s, int c); Return a pointer to the last occurrence of the character c in the string s. char *strsep(char **stringp, const char *delim); Extract the initial token in stringp that is delimited by one of the bytes in delim. size_t strspn(const char *s, const char *accept); Calculate the length of the starting segment in the string s that consists entirely of bytes in accept. char *strstr(const char *haystack, const char *needle); Find the first occurrence of the substring needle in the string haystack, returning a pointer to the found substring. char *strtok(char *s, const char *delim); Extract tokens from the string s that are delimited by one of the bytes in delim. size_t strxfrm(char *dest, const char *src, size_t n); Transforms src to the current locale and copies the first n bytes to dest. DESCRIPTION The string functions perform operations on null-terminated strings. See the individual man pages for descriptions of each function. SEE ALSO <STRONG><A HREF="/man3/index">index(3)</A></STRONG>, <STRONG><A HREF="/man3/rindex">rindex(3)</A></STRONG>, <STRONG><A HREF="/man3/stpcpy">stpcpy(3)</A></STRONG>, <STRONG><A HREF="/man3/strcasecmp">strcasecmp(3)</A></STRONG>, <STRONG><A HREF="/man3/strcat">strcat(3)</A></STRONG>, <STRONG><A HREF="/man3/strchr">strchr(3)</A></STRONG>, <STRONG><A HREF="/man3/strcmp">strcmp(3)</A></STRONG>, <STRONG><A HREF="/man3/strcoll">strcoll(3)</A></STRONG>, <STRONG><A HREF="/man3/strcpy">strcpy(3)</A></STRONG>, <STRONG><A HREF="/man3/strcspn">strcspn(3)</A></STRONG>, <STRONG><A HREF="/man3/strdup">strdup(3)</A></STRONG>, <STRONG><A HREF="/man3/strfry">strfry(3)</A></STRONG>, <STRONG><A HREF="/man3/strlen">strlen(3)</A></STRONG>, <STRONG><A HREF="/man3/strncasecmp">strncasecmp(3)</A></STRONG>, <STRONG><A HREF="/man3/strncat">strncat(3)</A></STRONG>, <STRONG><A HREF="/man3/strncmp">strncmp(3)</A></STRONG>, <STRONG><A HREF="/man3/strncpy">strncpy(3)</A></STRONG>, strp- <STRONG><A HREF="/man3/brk">brk(3)</A></STRONG>, <STRONG><A HREF="/man3/strrchr">strrchr(3)</A></STRONG>, <STRONG><A HREF="/man3/strsep">strsep(3)</A></STRONG>, <STRONG><A HREF="/man3/strspn">strspn(3)</A></STRONG>, <STRONG><A HREF="/man3/strstr">strstr(3)</A></STRONG>, <STRONG><A HREF="/man3/strtok">strtok(3)</A></STRONG>, <STRONG><A HREF="/man3/strxfrm">strxfrm(3)</A></STRONG> COLOPHON This page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. 2019-03-06 <STRONG><A HREF="/man3/STRING">STRING(3)</A></STRONG></PRE> <center> <h6>Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2025 <a href="http://www.he.net">Hurricane Electric</a>. All Rights Reserved.</h6></center> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10