Move string utility functions into their own translation unit

[ROCm/hip commit: ee8e11a720]
This commit is contained in:
Chris Kitching
2017-10-25 19:23:32 +01:00
parent 85fd2e6f51
commit 25517e41fd
3 changed files with 32 additions and 17 deletions
@@ -0,0 +1,17 @@
#include "StringUtils.h"
llvm::StringRef unquoteStr(llvm::StringRef s) {
if (s.size() > 1 && s.front() == '"' && s.back() == '"') {
return s.substr(1, s.size() - 2);
}
return s;
}
void removePrefixIfPresent(std::string &s, std::string prefix) {
if (s.find(prefix) != 0) {
return;
}
s.erase(0, prefix.size());
}