Answer the question
In order to leave comments, you need to log in
How to find a word in a string case insensitive?
"Привет, мир".indexOf("Привет")
returns 0, as it should "Привет, мир".indexOf("привет")
return -1, as it should NOT, replaced "Hello" with "hello" the letter "p" became small
how to make the search case-insensitive?
Answer the question
In order to leave comments, you need to log in
If you do not need to search for the position where the value was encountered, you can use the regular expression:
var str = 'Привет, мир';
var reg = /привет/i;
reg.test(str) => true
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question