diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-19 17:33:22 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-19 17:33:22 +0200 |
commit | 09ca7d144afaa4c3fb7727390d11a10c3a29d98e (patch) | |
tree | 4dadccef8ed72f8954b8d079f901709b578f6171 /src/StringUtils.cpp | |
parent | Created MobSpawnerEntity class. (diff) | |
parent | QtBiomeVisualiser: More gcc fixes. (diff) | |
download | cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.tar cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.tar.gz cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.tar.bz2 cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.tar.lz cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.tar.xz cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.tar.zst cuberite-09ca7d144afaa4c3fb7727390d11a10c3a29d98e.zip |
Diffstat (limited to '')
-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; +} + + + + |