Browse Source

add an example, similar to the one in strspn.3

OPENBSD_2_6
aaron 25 years ago
parent
commit
9118fe795f
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      src/lib/libc/string/strcspn.3

+ 15
- 1
src/lib/libc/string/strcspn.3 View File

@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: strcspn.3,v 1.2 1996/08/19 08:34:14 tholo Exp $
.\" $OpenBSD: strcspn.3,v 1.3 1999/06/04 16:39:27 aaron Exp $
.\" .\"
.Dd June 29, 1991 .Dd June 29, 1991
.Dt STRCSPN 3 .Dt STRCSPN 3
@ -65,6 +65,20 @@ The
.Fn strcspn .Fn strcspn
function function
returns the number of characters spanned. returns the number of characters spanned.
.Sh EXAMPLES
The following call to
.Fn strcspn
will return 3, since the first three characters of string
.Fa s
do not occur in string
.Fa charset :
.Bd -literal -offset indent
char *s = "foobar";
char *charset = "bar";
size_t span;
span = strcspn(s, charset);
.Ed
.Sh SEE ALSO .Sh SEE ALSO
.Xr index 3 , .Xr index 3 ,
.Xr memchr 3 , .Xr memchr 3 ,


Loading…
Cancel
Save