summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authormailwl <mailwl@gmail.com>2018-06-06 15:38:54 +0200
committermailwl <mailwl@gmail.com>2018-06-07 08:59:47 +0200
commita2efb1dd48cd2242ac9c435787915c1154266d60 (patch)
treecddeb32b5d74a6fb9f06bb994021413ebd197ae6 /src/common
parentMerge pull request #522 from mailwl/mm-u (diff)
downloadyuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.tar
yuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.tar.gz
yuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.tar.bz2
yuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.tar.lz
yuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.tar.xz
yuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.tar.zst
yuzu-a2efb1dd48cd2242ac9c435787915c1154266d60.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/string_util.cpp4
-rw-r--r--src/common/string_util.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 1d952874d..646400db0 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -64,6 +64,10 @@ std::string ArrayToString(const u8* data, size_t size, int line_len, bool spaces
return oss.str();
}
+std::string StringFromBuffer(const std::vector<u8>& data) {
+ return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
+}
+
// Turns " hej " into "hej". Also handles tabs.
std::string StripSpaces(const std::string& str) {
const size_t s = str.find_first_not_of(" \t\r\n");
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 65e4ea5d3..1f5a383cb 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -21,6 +21,8 @@ std::string ToUpper(std::string str);
std::string ArrayToString(const u8* data, size_t size, int line_len = 20, bool spaces = true);
+std::string StringFromBuffer(const std::vector<u8>& data);
+
std::string StripSpaces(const std::string& s);
std::string StripQuotes(const std::string& s);