Quantcast
Channel: Java OR operator in if string contains statement - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Alex G for Java OR operator in if string contains statement

$
0
0

try to use this code

 public static void main(String[] args) {        List<String> verticesposition2 = new ArrayList<String>();        verticesposition2.add("safdsfVertex");        verticesposition2.add("safdsfNamesfsd");        verticesposition2.add("notCONTAINS");        for (String str5 : verticesposition2){            if(!(str5.contains("Vertex")||str5.contains("Name")||str5.contains("Transmittance"))){                System.out.println(str5);            }        }    }

Output:

notCONTAINS

if speed isn't critical -- use those with regexp.


Viewing all articles
Browse latest Browse all 4

Trending Articles