JavaScript: String Comparison independent from Uppercase or Lowercase Writing
Question by Guest | 2013-12-10 at 14:49
From Java, I know the helpful function .equalsIgnoreCase() that can be used to compare two strings with ignoring the upper and lower case writing (case insensitive). In other words, "ABC" and "abc" are treated as equal.
But how is this in JavaScript? It seems to me that this function is not available there. So, how can I compare two Strings in JavaScript that ignores the case?
Related Topics
PHP: Check Strings with Ctype-Functions for Character Classes
Article | 0 Comments
Java: Case Insensitive Equals - String Comparison
Info | 0 Comments
Online Uppercase - Lowercase Converter
Tool | 0 Comments
Change uppercase and lowercase Writing of multiple Files
Tutorial | 0 Comments
Change File Extension Writing of many Files
Tutorial | 0 Comments
JavaScript: Remove last character from string
Tip | 5 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
Unfortunately, this function is not implemented in JavaScript. So, first, you have to rewrite both Strings to lower or upper characters completely and do the comparison afterwards:
Of course, this is a little bit more coding work and your code gets a little longer, but the result should be the same.2013-12-10 at 16:45