19119, "bradcray", "Add support for string.contains()?", "2022-01-26T01:54:24Z"
[splitting this apart from #18849 since chomp() may be a stumbling block all three of those requests going through, and since I have a future filed for this one already...]
While working with strings, I was disappointed to find that they didn't support a
.contains() method that would do a substring search and simply return true/false. While
find() can be used, the need to compare against
-1 makes it feel slightly clunkier for simple "true/false" tests where the location doesn't matter. This issue proposes adding a
string.contains() for such cases, which would make it similar to some of our other types that support
.contains() like domains, ranges, lists, maps, sets, and other collections.
Associated Future Test(s):
- Output of
chpl version 1.26.0 pre-release (b94e1c4598)