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
240 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
ID: 18768722
if( strcmp(str2,str1) > 0 )
0
 
LVL 84

Expert Comment

by:ozo
ID: 18768726
strcasecmp(str2,str1) > 0
0
 

Author Comment

by:4eyesgirl
ID: 18768732
you mean stricmp()?

0
 

Author Comment

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

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I test for current date? 9 109
Where is my core dump file in Ubuntu? 12 454
Compile VxWorks Toronado project under Visual Studio 11 222
Detect CR LF to each line 12 170
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

860 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