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

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

try to use this code public static void main(String[] args) { List<String> verticesposition2 = new ArrayList<String>(); verticesposition2.add("safdsfVertex");...

View Article


Answer by Evan Knowles for Java OR operator in if string contains statement

The || operator works on individual boolean terms, not to provide a bunch of different arguments.if((!str5.contains("Vertex")||!str5.contains("Name")||!str5.contains("Transmittance")){

View Article

Answer by Bohemian for Java OR operator in if string contains statement

Java doesn't have a syntax like that, but you can put the "or" in a regex:if (!str5.matches(".*(Vertex|Name|Transmittance).*")) {Note that java's matches() (unlike many other languages) must match the...

View Article

Java OR operator in if string contains statement

I have the following code.for (String str5 : verticesposition2) { if(!str5.contains(("Vertex")||("Name")||("Transmittance")) { System.out.println(str5); } }As you can see above if the string does NOT...

View Article
Browsing all 4 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>