I have this two string string1 and string2. What are my best option to check if string2 is present in string1. How do I implement in Ruby. Currently I am using Regex match.
I have this two string string1 and string2 . What are my best option
Share
Surprisingly,
count('a') > 0is giving me good results:But:
So: talking strictly about performance, you should do a test considering the distribution of your strings (which rarely is random). Talking about expressivity, maybe
include?is the best choice.