Instance
Comparison of two strings (case-sensitive):
Definition and usage
The strncmp () function compares two strings (case sensitive).
Note: strncmp () is binary safe and case-sensitive.
Tip: This function is similar to the strcmp () function,
The simulation implements the memory comparison function memcmp:The function is similar to strcmp, and can be used for the same string comparison, and returns a value of 0 if the same. If the former is greater than the latter, an integer value
Prototype: extern int strcmp (char *s1,char * s2,int N);
Usage: #include
Function: Compares the first n characters of a string S1 and S2.
Description
When S1
When S1=s2, the return value =0
When S1>s2, the return value >0
Example:
//
"to the program Ape on the road."For a developer, the ability to develop a free module in a system is the embodiment of its core value.For an architect, mastering the advantages of various languages and applying them to the system simplifies the
Common Linux C functions-memory and string operations-general Linux technology-Linux programming and kernel information. For more information, see the following. Bcmp (memory content comparison)
Related functions: bcmp, strcasecmp, strcmp, strcoll,
Bcmp (memory content comparison)
Related functions: bcmp, strcasecmp, strcmp, strcoll, strncmp, strncasecmp
Header file # include
Define the function int bcmp (const void * S1, const void * S2, int N );
Function Description: bcmp () is used to
C string operation (conversion) Note: several case-insensitive comparison functions in the text use stricmp in the original article. Later I found that the STD library in Linux is not available and changed to the strcasecmp series.
Function Name:
Unix| solution at present, Unix operating system in China's financial sector is widely used, UNIX with its powerful functions (time-sharing, multitasking, multi-user, network interconnection, graphics interface, etc.), much favored by financial
Function Name: strcpyFunction: copy one string to another.Usage: char * stpcpy (char * Destin, char * Source ); Program Example:# Include # Include Int main (void){Char string [10];Char * str1 = "abcdefghi ";Stpcpy (string, str1 );Printf ("% Sn",
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.