I need to search for a substring in a string and return that if it is there in the string.
What is the best way to do that in Erlang? Note that i dont know the place that substring happens in the bigger string so i need to do a search for that.
I need to search for a substring in a string and return that if
Share
You can use a regular expression:
See the documentation for re:run/3 for more information. In particular you may find that a different
captureoption suits your need.Or if you don’t need all the features of regular expressions, string:str/2 might be enough: