diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-19 14:31:18 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-19 14:31:18 +0200 |
commit | 4398156b2e56ccfcb41f750906501ecf446be045 (patch) | |
tree | dc1c070c6c7490619d8b05e30ace2c959f085bb2 /src/StringUtils.cpp | |
parent | Derp (diff) | |
parent | QtBiomeVisualiser: More gcc fixes. (diff) | |
download | cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.gz cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.bz2 cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.lz cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.xz cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.zst cuberite-4398156b2e56ccfcb41f750906501ecf446be045.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; +} + + + + |