tools lib string: Adopt prefixcmp() from perf and subcmd