0
我的JSON數據搜索字符與小寫和大寫
[
{"lastName":"Noyce","gender":"Male","patientID":19389,"firstName":"Scott","age":"53Y,"},
{"lastName":"noyce724","gender":"Male","patientID":24607,"firstName":"rita","age":"0Y,"}
]
var searchBarInput = TextInput.value;
var results = []; // initialize array of results
for (var i = 0; i < recentPatientsList.length; ++i) {
if (recentPatientsList[i].lastName.indexOf(searchBarInput) == 0) {
results.push(recentPatientsList[i].lastName);
}
}
alert('Results: ' + results.toString());
我得到的結果,但我想它的兩個匹配大寫和小寫當我搜索其開始在字的字符。
AAAAH的替代'toUpperCase' = P – 2011-04-23 22:44:35