diff options
author | madmaxoft <github@xoft.cz> | 2014-09-17 09:38:06 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-09-17 09:38:06 +0200 |
commit | 3406957f1b4b6b49c1b571dcceb2b463def9e4c3 (patch) | |
tree | d7f755d903cb372a796473f1a82299fd00521688 /src/StringUtils.cpp | |
parent | VoronoiMap: Added Jitter and OddRowOffset params. (diff) | |
download | cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.tar cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.tar.gz cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.tar.bz2 cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.tar.lz cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.tar.xz cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.tar.zst cuberite-3406957f1b4b6b49c1b571dcceb2b463def9e4c3.zip |
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r-- | src/StringUtils.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 5f88cbf64..73147eebc 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -869,3 +869,31 @@ void SetBEInt(char * a_Mem, Int32 a_Value) + +bool SplitZeroTerminatedStrings(const AString & a_Strings, AStringVector & a_Output) +{ + a_Output.clear(); + size_t size = a_Strings.size(); + size_t start = 0; + bool res = false; + for (size_t i = 0; i < size; i++) + { + if (a_Strings[i] == 0) + { + a_Output.push_back(a_Strings.substr(start, i - start)); + start = i + 1; + res = true; + } + } + if (start < size) + { + a_Output.push_back(a_Strings.substr(start, size - start)); + res = true; + } + + return res; +} + + + + |