I've got a situation where I'd like to check whether a particular path lands inside of a particular directory. My first instinct was to do something like
filepath.HasPrefix(filepath.Clean(path), dir)
but the procedure filepath.HasPrefix
is documented as existing for historic reasons only. Am I going to get the same effect by using strings.HasPrefix
, or is there something I'm missing?