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

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

$
0
0

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 whole string to return true, hence the .* at each end of the regex.


Viewing all articles
Browse latest Browse all 4

Trending Articles



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