I know that the string I'll get will be short ( < 50 chars). I also know that my substring will be matched exactly once (or won't be matched at all), and that it will appear de facto at the beginning of the string.
I cannot decide whether to use strings.Contains
, e.g., strings.Contains("123-ab-foo", "123-ab")
, or regexp
. I want the fastest way obviously.
Example of the use case:
if strings.Contains(current_string, MY_CONST){
// do smth
}