本文共 1040 字,大约阅读时间需要 3 分钟。
Performs a case-insensitive comparison of two strings.
intstricmp ( const char *string1, const char *string2 );
string1The first string for comparison.
string2The second string for comparison.
Example
int result;
char tmp[20];
char string1[] = "The quick brown dog jumps over the lazy fox";
char string2[] = "The QUICK brown dog jumps over the lazy fox";
result = strcmp( string1, string2 ); /* Case-sensitive comparison */
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
lr_output_message( "strcmp: String 1 is %s string 2", tmp );
result = stricmp( string1, string2 ); /* Case-insensitive comparison */
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
lr_output_message( "stricmp: String 1 is %s string 2", tmp );
return 0;
}
Result
Action.c(17): strcmp: String 1 is greater than string 2
Action.c(28): stricmp: String 1 is equal to string 2
最后修改于 2006-04-10 10:31
阅读(?)评论(0)
转载地址:https://blog.csdn.net/weixin_33701632/article/details/111943502 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!