2015年3月29日 星期日

[C] Compare Substrings Without Case Sensitivity


/* Compare Substrings Without Case Sensitivity */
#define strnicmp(__s1, __s2) \
((__s1 != NULL) && (__s2 != NULL) && \
(strlen(__s1) == strlen(__s2)) && \
(strnicmp(__s1, __s2, strlen(__s1)) == 0))


Value Meaning
Less than 0 string1 less than string2
0 string1 equivalent to string2
Greater than 0 string1 greater than string2

Reference:

Related Posts:

0 意見:

張貼留言