diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-10-20 16:20:00 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-10-20 16:20:00 +0800 |
| commit | 61e65e2c95779d29496e5859a6edac82fc3b1ddb (patch) | |
| tree | e0d70b7af955610b2a414b914c50d15f7af21015 /indra/llcommon/llstring.cpp | |
| parent | bbe494697ab37919f10009af516c711a685ac98e (diff) | |
| parent | 923f645a923e7f061f7ff2790d8510aa4b5ced36 (diff) | |
Merge tag 'Second_Life_Release#923f645a-26.5' into 26.5
Diffstat (limited to 'indra/llcommon/llstring.cpp')
| -rw-r--r-- | indra/llcommon/llstring.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index bb6d091a97..ff66849060 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)); } } |
