Wednesday, May 23, 2012

Which String method: "contains" or "indexOf > -1"?

Which of the following ways is an efficient way of determining substring containment?



if (str.indexOf("/") > -1)


or



if (str.contains("/")) 




No comments:

Post a Comment