'\"macro stdmacro
.if n .pH g3g.str @(#)str	40.10 of 10/27/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} str 3G "" "\&"
.if \nX=1 .ds x} str 3G ""
.if \nX=2 .ds x} str 3G "" "\&"
.if \nX=3 .ds x} str "" "" "\&"
.TH \*(x}
.SH "NAME"
\f4str\f1: \f4strfind\f1, \f4strrspn\f1, \f4strtrns\f1 \- string manipulations
.SH "SYNOPSIS"
\f4cc\f1
[\f2flag\fP \|.\|.\|.] \f2file\fP \|.\|.\|.
\f4\-lgen\f1
[\f2library\fP \|.\|.\|.]
.PP
\f4#include <libgen.h>\f1
.PP
\f4int strfind (const char \(**as1, const char \(**as2);\f1
.PP
\f4char \(**strrspn (const char \(**string, const char \(**tc);\f1
.PP
.nf
\f4char \(** strtrns (const char \(**str, const char \(**old, const char \(**new,
    char \(**result);\f1
.fi
.SH DESCRIPTION
\f4strfind\fP returns the offset of the second string, \f2as2\f1, if it is a 
substring of string \f2as1\f1.
.PP
\f4strrspn\fP returns a pointer to the first character in the string to be 
trimmed (all characters from the first character to the end of \f2string\f1 are in 
\f2tc\f1).
.PP
\f4strtrns\fP transforms \f4str\fP and copies it into \f2result\f1.  Any character 
that appears in \f2old\f1 is replaced with the character in the same position in 
\f2new\f1.  The \f2new\f1 result is returned.
.SH EXAMPLES
.nf
.ft 4
/\(** find pointer to substring "hello" in as1 \(**/
i = strfind(as1, "hello");
.sp 0.5
/\(** trim junk from end of string \(**/
s2 = strrspn(s1, "\(**?#$%");
\(**s2 = '\e0';
.sp 0.5
/\(** transform lower case to upper case \(**/
a1[] = "abcdefghijklmnopqrstuvwxyz";
a2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
s2 = strtrns(s1, a1, a2, s2);
.ft 1
.fi
.SH SEE ALSO
\f4string\fP(3C).
.SH DIAGNOSTICS
If the second string is not a substring of the first string
\f4strfind\fP returns \-1.
