I'm new in java and I was wonder if there is a way to check one string against another string, I've done it in Python like this"
text = "Tree"
if "re" in text:
print "yes, there is re exist in Tree"
do we have such way in java to check one sting if exist in another string?
Edit: I used String as an example, i was mainly looking for such function like how python has, as i mention in my caption "in" and "not in" in java, to compare any variable that exist within another variables.
in python i can compare array or list vs single String variable:
myList = ["Apple", "Tree"]
if "Apple" in myList:
print "yes, Apple exist"
even array vs array:
myList = ["Apple", "Tree","Seed"]
if ["Apple","Seed"] in myList:
print "yes, there is Apple and Seed in your list"
and single Integer vs array:
myNumber = [10, 5, 3]
if 10 in myNumber:
print "yes, There is 10"
I was mainly looking for function that if java provide so it can speed up the variables comparison.