toUpperCase() not working properly
Hi,
I'm working on a list where I want to be able to search in.
Though I've stumbled on a toUpperCase() problem.
When a line of text contains one or more quotes it doesn't change the case anymore.
var titles = [];
titles[ titles.length ] = "When I was little, this would work";
titles[ titles.length ] = "But now I'm confused.";
titles[ titles.length ] = "It won't even say ‘sorry’";
for( var index = 0; index < titles.length; index++ ) {
titles[ index ] = titles[ index ].toUpperCase();
}
This will uppercase the first line, but the 2nd and 3rd will remain as they are.
I haven't come across this problem before, so I'm guessing it's a Titanium conversion problem of some sort.
Can anybody verfiy it's not just my problem?
(Edit: changed typo)
1 Answer
-
It looks a little weird to me the way you are populating the array :)
Try this maybe:titles = [ "When I was little, this would work", "But now I'm confused.", "It won't even say ‘sorry’" ]
or if you are doing this in a dynamic way use push
titles=[]; titles.push("When I was little, this would work"); titles.push("But now I'm confused."); titles.push("It won't even say ‘sorry’");
now the for loop should work fine.