Ask Experts Questions for FREE Help !
Ask
    just_doit's Avatar
    just_doit Posts: 1, Reputation: 1
    New Member
     
    #1

    May 30, 2008, 12:30 PM
    Compare strings
    How can I compare two strings without using strcmp() function?
    retsoksirhc's Avatar
    retsoksirhc Posts: 912, Reputation: 71
    Senior Member
     
    #2

    May 30, 2008, 12:35 PM
    Not sure if it's exactly the same, but since PHP is based off C++, this might help.

    In PHP, you can compare string with the == and === operators. == means same value, and === means same value and type.
    theraos's Avatar
    theraos Posts: 4, Reputation: 2
    New Member
     
    #3

    Jun 15, 2008, 11:47 PM
    Is this a trick question?

    Do a strlen on each string make sure they are the same len and then do a memcmp

    Or write your own strcmp function!

    What is the purpose of this question - homework or an interview?
    webi's Avatar
    webi Posts: 13, Reputation: 2
    New Member
     
    #4

    Sep 24, 2008, 09:43 AM

    Frist of all, strcmp is a C function, not c++.
    You can find the answer with example in compare [C++ Reference]

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Sorting strings alphabetically [ 3 Answers ]

I'm making a source code for the program that sorts strings alphabetically in any sorting techniques(either quicksort,mergesort,heapsort or radix sort).. I will really appreciate if you can help me.. even just the program in sorting the strings in either the mention sorting techniques above.....

No Strings Relationship [ 4 Answers ]

I am sleeping with a guy, we are having I guess what you can call no strings sex. I really like him which I guess is my reason for sleeping with him, deep down I am hoping he will fall for me. Am I wasting my time and does he have any respect for me.

Is no strings attached sex OK [ 4 Answers ]

I just split up with my boyfriend and I have been in touch with a lad from school who I always had a soft spot for but we were good friends. He always used to ask me about sex and stuff at school and he said its because he wanted me. That wa 4 years ago. We have just been talking and he was...

Hampton bay ceiling fan (will pull strings) stopped working [ 5 Answers ]

I have Hampton Bay remote ceiling fans in 3 rooms of my new home I bought. I did not install them and now one has stopped working. It does not turn on with the remote or with the pull strings and there is no wall switch. I called Home Depot and they told me it was probably the receiver and to...

Sex with no strings? Impossible! [ 15 Answers ]

Ok, now I'm really confused! As some of you know I recently told my ex-girlfriend how I wanted to start seeing her again and possibly get back together. She told me she still thought about me all the time and missed me, however she was enjoying her freedom and being single right now. This weekend...


View more questions Search