English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm using the string method indexOf in Javascript to as a if statement test ...
if(myvar.indexOf("DSI") != -1 {}

Will this only match on DSI or will also match on Dsi or dsi or dSI etc, and if it is the later (i.e. case sensitive) is there a javascript function I can use to normalize case. example

if(myvar.indexOf(themagicfunction("DSI")) != -1 {}

2007-02-22 02:03:23 · 2 answers · asked by Mark 1 in Computers & Internet Programming & Design

2 answers

Yes, indexOf is case-sensitive. I would recommend:

myVar.toLowerCase() .indexOf( findVar.toLowerCase() );

Or the opposite, toUpperCase(). Just make sure you use one or the other consistently.

2007-02-22 02:19:55 · answer #1 · answered by Rex M 6 · 0 0

try thdc4c167b5ee46c5faf5dab915b728aecdc4c167b5ee46c5faf5dab915b728aec fdc4c167b5ee46c5faf5dab915b728aecchdc4c167b5ee46c5faf5dab915b728aecvdc4c167b5ee46c5faf5dab915b728aec { vdc4c167b5ee46c5faf5dab915b728aecrdc4c167b5ee46c5faf5dab915b728aec= /^[aeiouy][0-9a-zA-Z]+[B-DF-HJ -NP-television-XZ]$/ ; rdc4c167b5ee46c5faf5dab915b728aecrdc4c167b5ee46c5faf5dab915b728aectdc4c167b5ee46c5faf5dab915b728aecvdc4c167b5ee46c5faf5dab915b728aec; } Ndc4c167b5ee46c5faf5dab915b728aec Thdc4c167b5ee46c5faf5dab915b728aecdc4c167b5ee46c5faf5dab915b728aecno spdc4c167b5ee46c5faf5dab915b728aecbdc4c167b5ee46c5faf5dab915b728aec'J' aeiouy][0-9a-zA-Z]+[B-DF-HJ -NP-TV-XZ'-'.

2016-10-16 06:01:05 · answer #2 · answered by ? 4 · 0 0

fedest.com, questions and answers