Closed Thread
Results 1 to 4 of 4

Thread: String::Compare

  1. #1
    NeedHelp Guest

    String::Compare

    Something that has always annoyed me about managed C++ is not having the ability to compare strings like

    Code:
    String^ c = "this";
    String^ d = "that";
    
    if (c == d) {}
    instead you have to use code like

    Code:
    String^ c = "this";
    String^ d = "that";
    
    if (String::Compare(c,d) == 0) {
    ....
    }
    Why is this? And why does 0 equal true? hasn't 1 always been the value that equals true? Why did they have to change the entire language. It doesn't even resemble ANSI C++.

  2. CODECALL Circuit advertisement

     
  3. #2
    Jordan Guest
    Not sure why they changed it like that but it annoys me as well. True is now 0 because anything other than 0 is false. That means it can be -12000 or 100 to be false.

  4. #3
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    Uhh...doesn't strcmp use the same returns?

  5. #4
    RobSoftware is offline Programmer
    Join Date
    Nov 2005
    Posts
    143
    Rep Power
    0
    Its not just String::Compare but everything now returns 0 for true in managed C++.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 06-28-2011, 08:05 AM
  2. Error while using compare
    By thatsme in forum C and C++
    Replies: 7
    Last Post: 09-07-2010, 01:46 PM
  3. compare two wav file
    By prof.deedee in forum Computer Software/OS
    Replies: 5
    Last Post: 08-17-2010, 07:08 AM
  4. help using loop to compare string?
    By hayschooler in forum Java Help
    Replies: 5
    Last Post: 03-15-2010, 06:46 AM
  5. [ASK]Compare 2 String
    By nitediver in forum C and C++
    Replies: 5
    Last Post: 10-06-2009, 06:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts