⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.3

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 3
字号:
.\" SCCSID: @(#)string.3	8.3	3/5/91.TH string 3.SH Namestrcasecmp, strncasecmp, strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen, strchr, strrchr, strpbrk, strspn, strcspn, strstr, strtok, index, rindex \- string operations.SH Syntax.nf.B #include <strings.h>.RS.PPor.RE.PP.B #include <string.h>.PP.B strcasecmp(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP  .B strncasecmp(\fIs1, s2, n\fP).B char *\fIs1, *s2\fP;.PP.B char *strcat(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP.B char *strncat(\fIs1, s2, n\fP).B char *\fIs1, *s2\fP;.PP.B int strcmp(\fIs1, s2\fP).B unsigned char *\fIs1, *s2\fP;.PP.B int strncmp(\fIs1, s2, n\fP).B unsigned char *\fIs1, *s2\fP;.B int \fIn\fP.PP.B char *strcpy(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP.B char *strncpy(\fIs1, s2, n\fP).B char *\fIs1, *s2\fP;.B int \fIn\fP.PP.B size_t strlen(\fIs\fP).B char *\fIs\fP;.PP.B char *strchr(\fIs, c\fP).B char *\fIs\fP;.B int \fIc\fP;.PP.B char *strrchr(\fIs, c\fP).B char *\fIs\fP;.B int \fIc\fP;.PP.B char *strpbrk(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP.B size_t strspn(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP.B  size_t strcspn(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP.B char *strtok(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.PP.B char *index(\fIs, c\fP).B char *\fIs, c\fP;.PP.B char *rindex(\fIs, c\fP).B char *\fIs, c\fP;.PP.B char *strstr(\fIs1, s2\fP).B char *\fIs1, *s2\fP;.fi.SH DescriptionThe arguments \fIs1\fR, \fIs2\fR, and \fIs\fR point to strings(arrays of characters terminated by a null character).  Thefunctions .PN strcat ,.PN strncat ,.PN strcpy ,and.PN strncpysubroutinesall alter \fIs1\fR.  These functions do not check for overflow of the arraypointed to by \fIs1\fR..PPThe.PN strcatsubroutine appends a copy of string.I s2to the end of string.IR s1 .The.PN strncatsubroutine copies at most.I ncharacters.  Both return a pointer to the null-terminated result..PPThe.PN strcmpsubroutine compares its arguments and returns an integergreater than, equal to, or less than 0, according as.I s1is lexicographically greater than, equal to, or less than.IR s2 .The.PN strncmpsubroutine makes the same comparison but looks at at most.I ncharacters. The.PN strcasecmp and .PN strncasecmp subroutines are identical infunction, but are case insensitive.  The returned lexicographic difference reflects a conversion to lower-case..PPThe.PN strcpysubroutine copies string.I s2to.I s1,stopping after the null character has been copied.The.PN strncpysubroutine copies exactly.I ncharacters, truncating \fIs2\fR or adding null charactersto \fIs1\fR if necessary.  The result will not be null-terminatedif the length of \fIs2\fR is \fIn\fR or more.  Each functionreturns \fIs1\fR..PPThe.PN strlensubroutinereturns the number of characters in.IR s ,not including the terminating null character..PPThe.PN strstrsubroutinereturns a pointer to the first occurrence of .I s2 (excluding the terminatingnull character) in .I s1, or a NULL pointer if .I s2 does not occur in .I s1. If the length of.I s2is zero,.PN strstrreturns .I s1..PPThe.PN strchr(.PN strrchr) function returns a pointer to the first (last) occurrence of character\fIc\fR in string \fIs\fR, or a NULL pointer is \fIc\fR does notoccur in the string.  The null character terminating a string isconsidered to be part of the string..PP.IThe.PN strpbrksubroutinereturns a pointer to the first occurrence in string \fIs1\fRof any character from string \fIs2\fR,or a NULL pointer if no character from\fIs2\fR exists in \fIs1\fR..PP.IThe.PN strspn(.PN strcspn)subroutinereturns the length of the initial segment of string \fIs1\fRwhich consists entirely of characters from (not from) string\fIs2\fR..PPThe.PN strtoksubroutineconsiders the string \fIs1\fR to consist of a sequence of zeroor more text tokens separated by spans of one or more charactersfrom the separator string \fIs2\fR.  The first call (withpointer \fIs1\fR specified) returns a pointer to the first characterof the first token, and will have written a null character into\fIs1\fR immediately following the returned token.  The functionkeeps track of its position in the string between separate calls,so that subsequent calls (which must be made with the first argument aNULL pointer) will workthrough the string \fIs1\fR immediately followingthat token.  In this way, subsequent calls will work through thestring \fIs1\fR until no tokens remain.  The separator string\fIs2\fR may be different from call to call.  When no token remainsin \fIs1\fR, a NULL pointer is returned..PPThe.PN index( .PN rindex)subroutinereturns a pointer to the first (last) occurrence of character .I cin string.I s,or zero if.I cdoes not occur in  the string..NTThe <string.h> header file is provided for compatibilitywith System V; both <string.h> and <strings.h> refer tothe same file..brThe.PN strcmpand.PN strncmpsubroutinesdo unsigned character comparisons..NE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -