JavaScript: String Comparison independent from Uppercase or Lowercase Writing
Question by Guest | Last update on 2024-07-22 | Created on 2013-12-10
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 using this function.
But how is it about JavaScript? It seems to me that such a 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
JavaScript: Remove last character from string
Tip | 5 Comments
Java: Smaller/Larger Comparison of Strings - The operator > is undefined for the argument type(s) java.lang.String
Question | 1 Answer
jQuery: Scroll up and down with and without JavaScript
Tip | 0 Comments
JavaScript: Show and hide HTML area by clicking a link
Tutorial | 0 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 convert respectively rewrite both Strings to lower or upper case characters completely in order to carry out 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.Last update on 2024-07-22 | Created on 2013-12-10