Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strspn(3) [minix man page]

STRSPN(3)						     Linux Programmer's Manual							 STRSPN(3)

NAME
strspn, strcspn - get length of a prefix substring SYNOPSIS
#include <string.h> size_t strspn(const char *s, const char *accept); size_t strcspn(const char *s, const char *reject); DESCRIPTION
The strspn() function calculates the length (in bytes) of the initial segment of s which consists entirely of bytes in accept. The strcspn() function calculates the length of the initial segment of s which consists entirely of bytes not in reject. RETURN VALUE
The strspn() function returns the number of bytes in the initial segment of s which consist only of bytes from accept. The strcspn() function returns the number of bytes in the initial segment of s which are not in the string reject. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +--------------------+---------------+---------+ |Interface | Attribute | Value | +--------------------+---------------+---------+ |strspn(), strcspn() | Thread safety | MT-Safe | +--------------------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD. SEE ALSO
index(3), memchr(3), rindex(3), strchr(3), string(3), strpbrk(3), strsep(3), strstr(3), strtok(3), wcscspn(3), wcsspn(3) COLOPHON
This page is part of release 4.15 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/. 2015-08-08 STRSPN(3)

Check Out this Related Man Page

strspn(3)						     Library Functions Manual							 strspn(3)

NAME
strcspn, strspn - Returns length of initial segment of string LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> size_t strcspn( const char *s1, const char *s2); size_t strspn( const char *s1, const char *s2); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strcspn(), strspn(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a character string being checked for an initial segment. Points to a string containing a set of bytes that define the initial segment. DESCRIPTION
The strspn() function computes the length of the maximum initial segment of the string pointed to by the s1 parameter, which consists entirely of bytes from the string pointed to by the s2 parameter. The strcspn() function computes the byte length of the maximum initial segment of the string pointed to by the s1 parameter, which consists entirely of bytes that are not from the string pointed to by the s2 parameter. The strspn() and strcspn() functions treat the s2 parameter as a series of bytes; these functions do not treat a multibyte character as a single unit but rather as a series of separate bytes. There are no equivalent functions for multibyte character strings. The wcsspn() and wcscspn() functions provide the same functionality for wide character strings. RETURN VALUES
Upon successful completion, the strcspn(), and strspn() functions return the length of the string segment. [Tru64 UNIX] On error, a value of -1 cast to size_t is returned. RELATED INFORMATION
Functions: string(3), wcsspn(3)/wcscspn(3) Standards: standards(5) delim off strspn(3)
Man Page

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

designing a shell

Hi I need to expand some shell code so it would be able to do more than it is doing now. Currently it can do stuff like quit when q is pressed, display a prompt but not much more. I have to make the shell have capabilities like cd (changing directories) redirection of input and output, for... (2 Replies)
Discussion started by: newtoallthis
2 Replies

2. Programming

stupid question about ascii characters

i know it's out there, but I cannot remember how to check if a given ascii character string contains all digits or not ... any ideas? ie...function("123") --> OK function("NOT_A_NUMBER") --> returns error thanks!! (2 Replies)
Discussion started by: jalburger
2 Replies

3. Programming

C program in Unix / Linux - Time differences

Hi Friends, When Iam running c program in redhat linux 7.3 version and PCQ Linux 8.0 version, its taking around 20 seconds. But when Iam running it in HP-UX Release 11i, its taking around 3 minutes. Can anyone throw light on this. Thanks in advance, Praveen. (11 Replies)
Discussion started by: chprvkmr
11 Replies

4. Programming

substituting one string for another

I have a Linux C program I'm writing that has one section where, within a large string, I need to substitute a smaller string for another, and those probably won't be the same size. For instance, if I have a string: "Nowisthetimeforallgoodmen" and I want to substitute 'most' for 'all' the... (2 Replies)
Discussion started by: cleopard
2 Replies

5. UNIX for Dummies Questions & Answers

m1join.c

Joins from pipes many to one in one pass and other tricks: $ cat mysrc/m1join.c #include <stdio.h> #include <stdlib.h> #include <strings.h> #include <limits.h> static int msep_ign = 1 ; static int fullouter = 0 ; static int leftouter = 0 ; static int rightouter = 0 ;... (0 Replies)
Discussion started by: DGPickett
0 Replies

6. Homework & Coursework Questions

Splitting a numbers binary representation for a double.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Split a 64bit hexadecimal number into two 32 bit numbers or keys. 2. Relevant commands, code, scripts,... (5 Replies)
Discussion started by: robin_simple
5 Replies

7. Shell Programming and Scripting

C command not found

Dear All, I am trying to install a program in Opensuse linux and while issuing the 'make' command, its showing me an error /bin/sh: C: command not found Kindly help me to troubleshoot the problem. I have gcc, c++ all install in the linux machine. Thanks (9 Replies)
Discussion started by: biochemist
9 Replies

8. Programming

Wildcard Pattern Matching In C

I've been having problems lately trying to do pattern matching in C while implementing wildcards. Take for instance the following code: #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <dirent.h> #include <string.h> ... (14 Replies)
Discussion started by: Azrael
14 Replies