Move the function `HasPrefix()` from `netaddress.cpp` to `util/string.h` so it can be reused by `CNetAddr` methods (and possibly others).
Partial backport (1/4) of core PR19845:
https://github.com/bitcoin/bitcoin/pull/19845/commits/d2bb681f96fb327b4c4d5b2b113692ca22fdffbf