2013-10-10 57 views
-7

基本上,我在寻找的是字符串的.equals()命令的反参数。有没有一个类似.notEquals()的命令?我基本上需要比较一个字符串与用户输入,如果用户输入不正确,我想打印一些东西。寻找.equals()

+0

嗯..'.equals()== false'呢? (没有指定一种语言,所以我假定基于C语言)。 – MasterMastic

+2

看起来你还没有通知。时间来改变:http://stackoverflow.com/about –

+0

这是什么语言......也许C#? – Andrew

回答

1

是的,但用什么语言?

在Java & C#中,你可以使用:

!StringInput.Equals("ValueToCompare");

0

您可以简单地使用了 “!”运营商。 像这样:

if(!string_var.equals(other_string)){ 
    //here you put the code if the string is not equal to 
}else{ 
    //here you put the code if the string IS EQUAL to 
} 
0

您可以使用应用到.equal结果的的!否定布尔运算符。

这就像是说不等于