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.
Hi,
if your req is that any of str1 to str4 is not equal to 0, then add in resultlist, then the below code may help you:
if (!( (str1.equals("000000")) && (str2.equals("00000000")) && (str3.equals("000000")) && (str4.equals("00000000"))))
result.addValue("");
Thanks,
Rajeev Gupta
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.