summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.cpp
diff options
context:
space:
mode:
authorAndrew Meadows <leviathan@lindenlab.com>2026-10-16 19:01:06 -0700
committerGitHub <noreply@github.com>2026-10-16 19:01:06 -0700
commit923f645a923e7f061f7ff2790d8510aa4b5ced36 (patch)
tree0f1b8a6434c6ea5fb2c80b52f4afa695b4383d93 /indra/llcommon/llstring.cpp
parent51f2817d3ab3b9454ec2848042420dfcc17d7bb6 (diff)
parentd4270de9eac1f79f267c2fae75c57c2464dc6bbd (diff)
Merge pull request #6202 from secondlife/project/game-control
Diffstat (limited to 'indra/llcommon/llstring.cpp')
-rw-r--r--indra/llcommon/llstring.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 07adf71d18..892671099e 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -1119,18 +1119,27 @@ void LLStringOps::setupDayFormat(const std::string& data)
}
-std::string LLStringOps::getDatetimeCode (std::string key)
+std::string LLStringOps::getDatetimeCode(const std::string& key)
{
- std::map<std::string, std::string>::iterator iter;
+ std::map<std::string, std::string>::iterator iter = datetimeToCodes.find(key);
+ return iter == datetimeToCodes.end() ? LLStringUtil::null : iter->second;
+}
- iter = datetimeToCodes.find (key);
- if (iter != datetimeToCodes.end())
+void LLStringOps::splitString(const std::string& text, char delimiter,
+ std::function<void(const std::string&)> handler)
+{
+ std::size_t from = 0;
+ for (std::size_t i = 0; i < text.size(); ++i)
{
- return iter->second;
+ if (text[i] == delimiter)
+ {
+ handler(text.substr(from, i - from));
+ from = i + 1;
+ }
}
- else
+ if (from <= text.size())
{
- return std::string("");
+ handler(text.substr(from));
}
}