2 .\" Copyright 1989 AT&T Copyright (c) 1999, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH STRFIND 3GEN "Jan 20, 1999"
8 strfind, strrspn, strtrns, str \- string manipulations
12 cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lgen\fR [ \fIlibrary\fR ... ]
15 \fBint\fR \fBstrfind\fR(\fBconst char *\fR\fIas1\fR, \fBconst char *\fR\fIas2\fR);
20 \fBchar *\fR\fBstrrspn\fR(\fBconst char *\fR\fIstring\fR, \fBconst char *\fR\fItc\fR);
25 \fBchar *\fR \fBstrtrns\fR(\fBconst char *\fR\fIstring\fR, \fBconst char *\fR\fIold\fR, \fBconst char *\fR\fInew\fR,
26 \fBchar *\fR\fIresult\fR);
32 The \fBstrfind()\fR function returns the offset of the first occurrence of the
33 second string, \fIas2\fR, if it is a substring of string \fIas1\fR. If the
34 second string is not a substring of the first string \fBstrfind()\fR returns
38 The \fBstrrspn()\fR function trims chartacters from a string. It searches from
39 the end of \fIstring\fR for the first character that is not contained in
40 \fItc\fR. If such a character is found, \fBstrrspn()\fR returns a pointer to
41 the next character; otherwise, it returns a pointer to \fIstring\fR.
44 The \fBstrtrns()\fR function transforms \fIstring\fR and copies it into
45 \fIresult\fR. Any character that appears in \fIold\fR is replaced with the
46 character in the same position in \fInew\fR. The \fInew\fR result is
51 When compiling multithreaded applications, the \fB_REENTRANT\fR flag must be
52 defined on the compile line. This flag should only be used in multithreaded
56 \fBExample 1 \fRAn example of the \fBstrfind()\fR function.
60 \fB/* find offset to substring "hello" within as1 */
61 i = strfind(as1, "hello");
62 /* trim junk from end of string */
63 s2 = strrspn(s1, "*?#$%");
65 /* transform lower case to upper case */
66 a1[] = "abcdefghijklmnopqrstuvwxyz";
67 a2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
68 s2 = strtrns(s1, a1, a2, s2);\fR
76 See \fBattributes\fR(5) for descriptions of the following attributes:
84 ATTRIBUTE TYPE ATTRIBUTE VALUE
92 \fBstring\fR(3C), \fBattributes\fR(5)