简体   繁体   English

使JOptionPane不区分大小写?

[英]Making JOptionPane not case sensitive?

I can't seem to find out anywhere but if I remember correctly there was something you could add to the end of a JOptionPane statement to make it case insensitive ? 我似乎找不到任何地方,但是如果我没记错的话,可以在JOptionPane语句的末尾添加一些内容以使其不区分大小写? Here's my code, focusing on string a 这是我的代码,重点放在字符串a

....  scanner.close();
for (int i = 1; i < lines.size(); i += 2)
{
}

It's not really about JOptionPane, but what happens after it has done its work :-) 它与JOptionPane无关,但是在完成工作之后会发生什么呢:-)

Use equalsIgnoreCase when comparing the two strings. 比较两个字符串时,请使用equalsIgnoreCase

if (a.equalsIgnoreCase(answer) && input.equals("instant")) {
            ^^^^^^^^^^
    ...
}
else if (a.equalsIgnoreCase(answer) && input.equals("generate")) {
                 ^^^^^^^^^^
    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM