Solved

Need a C function to compare two string (find out which one is bigger string with case non sensitive)

Posted on 2007-03-21
4
231 Views
Last Modified: 2010-05-18
HI expert -

I need a C functions does the following:

int StringCompare(char* str1, char* str2){
   if (str2 > str1) // jeremy, str2 Kevin
    return 1;
  else return 0;
}

I know stricmp() can compare two strings, but it only return 1 when two string are different, but compare which string is bigger.  

Please help!
0
Comment
Question by:4eyesgirl
  • 2
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
Comment Utility
if( strcmp(str2,str1) > 0 )
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
strcasecmp(str2,str1) > 0
0
 

Author Comment

by:4eyesgirl
Comment Utility
you mean stricmp()?

0
 

Author Comment

by:4eyesgirl
Comment Utility
I didn't realize stricmp() already take care of my issue.  Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now