util: move HasPrefix() so it can be reused
Summary:
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
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9186