Answers for "javascript string insensitive compare"

3

Javascript case insensitive string comparison

var name1 = "Taylor Johnson";
var name2 ="taylor johnson";

//convert to lowercase for case insensitive comparison
if(name1.toLowerCase() === name2.toLowerCase()){
    //names are the same
}
Posted by: Guest on July-25-2019
0

how to compare strings in javascript ignoring case sensitive

const str1 = '[email protected]';
const str2 = '[email protected]';

str1 === str2; // false
str1.toLowerCase() === str2.toLowerCase(); // true
Posted by: Guest on September-22-2020
0

javascript string insensitive compare

const str1 = '[email protected]';
const str2 = '[email protected]';

str1 === str2; // false

// will return 0, means these two strings are equal according to `localeCompare()`
str1.localeCompare(str2, undefined, { sensitivity: 'accent' });
Posted by: Guest on April-22-2021

Code answers related to "javascript string insensitive compare"

Code answers related to "Javascript"

Browse Popular Code Answers by Language