Prepared By : Uday Shah - HOD(IT)
Contact No : 7600044051
--------------------------------------------------------------------------------------------------------------------------
String Library Function
Strcpy
Copies
all most haracters of src to dest
Declaration:
char *strcpy(char *dest, const char *src);
Remarks:
Copies string src to dest, stopping after
the terminating null character has been moved.
strncpy
Copies
at most maxlen characters of src to dest
Declaration:
char *strncpy(char *dest, const char *src,
size_t maxlen);
Remarks:
strncpy copies up to maxlen characters from
src into dest, truncating or null-padding dest. _fstrncpy is the far
version.
The target string, dest, might not be
null-terminated if the length of src
is maxlen or more.
strcat
Appends
one string to another
Declaration:
char
*strncat(char *dest, const char *src, size_t maxlen);
Remarks:
strncat copies at most maxlen characters of
src to the end of dest and then appends
a null character.
strchr
Scans
a string for the first occurence of a given character
Declaration:
char *strchr(const char *s, int c);
Remarks:
strchr scans a string in the forward direction,
looking for a specific character.
strrchr
Finds
the last occurrence of c in s
Declaration:
char *strrchr(const char *s, int c);
Remarks:
strrchr scans a string in the reverse direction,
looking for a specific character.
strcmp
strcmp
compare two strings
int strcmp(const char *s1, const char*s2);
Remarks:
The string comparison starts with the first
character in each string and continues with subsequent characters until the
corresponding characters differ or until the end of the strings is reached.
To use strcmp, you must include STRING.H. This macro
is provided for compatibility with other C compilers.
strncmp
strncmp
compare portions of two strings. strncmpi is a macro compares portions of two
strings, without case sensitivity
Declaration:
int strncmp (const char *s1, const char *s2, size_t
maxlen);
Remarks:
Each
of these routines compares s1 to s2, looking at no more than maxlen characters.
The string comparison starts with the first
character in each string and continues with subsequent characters until the corresponding
characters differ or until maxlen characters have been examined.
To
use strncmp, you must include STRING.H.
strcspn
strcspn scan a string for a segment that DOES NOT
contain a subset of a set of characters .strspn scan a string for a segment
that IS a subset of a set of characters
Declaration:
size_t strcspn(const char *s1, const char *s2);
Remarks:
strcspn find the initial segment of string s1 that
consists entirely of characters NOT from string s2.
Strlen
Calculates
length of a string
Declaration:
size_t strlen(const char *s);
Remarks:
strlen
calculates the length of s.
Return
Value:
Returns
the number of characters in s, not counting the terminating null
strpbrk
Scans
one string for the first occurrence of any character that is in a second string
Declaration:
char *strpbrk(const char *s1, const char *s2);
Remarks:
strpbrk scans a string, s1, for the first occurrence
of any character appearing in s2.
Please Give Your Comment and Share it......