About 3,760,000 results
Open links in new tab
  1. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · Whereas equals in string compares the string contents. So the question is if all the strings are cached in the system, how come == returns false whereas equals return true?

  2. java - String.equals versus == - Stack Overflow

    Let's see it happen in Java terms. Here's the source code of String's equals() method: It compares the Strings character by character, in order to come to a conclusion that they are indeed equal. …

  3. java - How the equals () method works - Stack Overflow

    Jul 12, 2021 · String class overrides the default implementation of the equals () method of the Object class. The equals method code that you have provided is not from String class but from …

  4. c# - Why would you use String.Equals over ==? - Stack Overflow

    Nov 2, 2009 · I recently was introduced to a large codebase and noticed all string comparisons are done using String.Equals() instead of == What's the reason for this, do you think?

  5. What is the correct way to check for string equality in JavaScript?

    Just one addition to answers: If all these methods return false, even if strings seem to be equal, it is possible that there is a whitespace to the left and or right of one string.

  6. windows - string comparison in batch file - Stack Overflow

    Feb 19, 2013 · How do we compare strings which got space and special chars in batch file? I am trying: if %DevEnvDir% == "C:\\Program Files (x86)\\Microsoft Visual Studio …

  7. c# - String.Equals () not working as intended - Stack Overflow

    When using LINQ to Entities, it will automatically convert LINQ into SQL. And if the database field you are doing a .Equals on does not have a collate of NOCASE (SQLite in my example) then it …

  8. How do I compare two string variables in an 'if' statement in Bash?

    The double equals sign is tolerated in Bash, but not in some other dialects. For portability, the single equals sign should be preferred, and if you target Bash only, the double brackets [[ …

  9. C# string comparison ignoring spaces, carriage return or line breaks

    Jan 17, 2011 · How can I compare 2 strings in C# ignoring the case, spaces and any line-breaks. I also need to check if both strings are null then they are marked as same. Thanks!

  10. Comparing strings in VB.NET - Stack Overflow

    String.Compare returns an Integer: less than zero if str1 comes before str2 alphabetically, greater than zero if str2 precedes str1 alphabetically, and zero if the strings are the same. The …