从字符串中的数组中查找内容

时间:2018-05-31 01:30:02

标签: java arrays string

我正在创建一个java applet,您可以将电子邮件复制到垃圾邮件内容中并进行比较。我做得最多,但我在比较单词时遇到了问题。这是我的代码,我遇到了问题。

    int SpamCounter = 0;

    String[] spamWords = new String[] {
        "Various words"
        };

    String EmailInput = EmailTA.getText();


    String sWords = Arrays.toString(spamWords);

    for (String spamWord : spamWords) {
        if (EmailInput.equalsIgnoreCase(sWords) )
        {
            JOptionPane.showMessageDialog(this, "Yes " + spamWord);
            SpamCounter = SpamCounter++ ;
        }else{
            JOptionPane.showMessageDialog(this, "No " + spamWord);

        }
    }
    String result = "Your Spam Count is: " + SpamCounter ;
    JOptionPane.showMessageDialog(this, result);
}                                      

0 个答案:

没有答案