Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to compare strings in javascript ignoring case sensitive

const str1 = 'Bill@microsoft.com';
const str2 = 'bill@microsoft.com';

str1 === str2; // false
str1.toLowerCase() === str2.toLowerCase(); // true
Comment

case insensitive string comparison in JavaScript

let dummyString1 = "rock";
let dummyString2 = "Rock";
let pattern = new RegExp('^' + dummyString2 + '$', 'i');

if (pattern.test(dummyString1)) {
  console.log("String Matched");
} else {
  console.log("String Not Matched");
}
Comment

javascript string insensitive compare

const str1 = 'Bill@microsoft.com';
const str2 = 'bill@microsoft.com';

str1 === str2; // false

// will return 0, means these two strings are equal according to `localeCompare()`
str1.localeCompare(str2, undefined, { sensitivity: 'accent' }); 
Comment

PREVIOUS NEXT
Code Example
Javascript :: konva line thickness 
Javascript :: how to add an event listener to a function javascript 
Javascript :: js how to find max value in an array 
Javascript :: autocomplete list angular 8 material 
Javascript :: js phone number validation 
Javascript :: deep copy javascript 
Javascript :: v-on shorthand 
Javascript :: sequelize get data 
Javascript :: error first line of nextjs file 
Javascript :: are you sure you want to close this window javascript 
Javascript :: string length javascript 
Javascript :: how to clear array in javascript 
Javascript :: react bootstrap hide toggle menu when scrolling down 
Javascript :: angularjs show form validation errors 
Javascript :: iterate over json data javascript 
Javascript :: drag drop in blazor 
Javascript :: @input in angular 
Javascript :: first node prog using express 
Javascript :: open file method in node js 
Javascript :: iconify react 
Javascript :: object.keys javascript 
Javascript :: json type error at login 
Javascript :: TypeError: fxn.call is not a function 
Javascript :: recaptcha v3 
Javascript :: vue watch 
Javascript :: set radgrid datasource clientside 
Javascript :: gojs select node programmatically 
Javascript :: localstorage nextjs 
Javascript :: get coords of html element js 
Javascript :: react-native-charts-wrapper:compileDebugJavaWithJavac FAILED 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =