The Character
class of Java API has various functions you can use.
You can convert your char to lowercase at both sides:
Character.toLowerCase(name1.charAt(i)) == Character.toLowerCase(name2.charAt(j))
There are also a methods you can use to verify if the letter is uppercase or lowercase:
Character.isUpperCase('P')
Character.isLowerCase('P')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…