If I use string.contains() on a string that may have regular expressions, will the regular expressions trigger? For example string.contains(“alphawbet”).
Am I right in thinking that contains will be fine but matches will not? Thank you
Advertisement
Answer
String.contains()
accepts CharSequence
as argument and doesn’t “trigger” regexes that it or processing string may contain.
Returns true if and only if this string contains the specified sequence of char values.
From here.