on ‎2007 Feb 12 12:03 PM
Hi Group,
In Java How to Check the Condition for not equals to
When I am using the following code I am not getting expected result:
String str1 = new String();
String str2 = new String();
String str3 = new String();
String str4 = new String();
for (int i =0; i<a.length; i++)
{
str1=a<i>.substring(0,6);
str2=a<i>.substring(7,14);
str3=a<i>.substring(18,23);
str4=a<i>.substring(24,31);
if ( (!str1.equals("000000")) || (!str2.equals("00000000")) || (!str3.equals("000000")) ||
(!str4.equals("00000000")))
result.addValue("");
}
Request clarification before answering.
or you can use this...this will also work
if ( !( (str1.equals("000000")) || (str2.equals("00000000")) || (str3.equals("000000")) ||
(str4.equals("00000000")) )
result.addValue("");
}
Note: I applied De Morgans law to what others said....[ !A && !B = !(A || B) ]
i am using something i learned during my bachelor's degree....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.