Hey i have written a method to take two lists of strings as input, merge these two lists together, then go through each list individually and if it contains a word in the merge list, to return 1 otherwise return 0. However currently this only checks if the "exact" same string is in the list, as in it is case sensitive, i need it to be case insensitive for what i am trying to do
The return statement here is redundant i am just returning an int to test the method. Does anybody know how i can perform the same test while ignoring case? I would appreciate any help Thanks
posted 9 years ago
I think you said the problem is that you want to ignore case so "hello" matches "Hello" in your search?
You could put everything into the list in lower case and do contains(word.toLowerCase())
You could make your own class instead of Strings ... something that holds a String and has an equals() method that ignores case.
Either of those sound useful?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi