mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
toml parser update + 'toml' module is built-in now
This commit is contained in:
parent
ffdeac5c1f
commit
c94d40ab02
15 changed files with 252 additions and 178 deletions
|
|
@ -443,3 +443,14 @@ std::string util::format_data_size(size_t size) {
|
|||
std::to_string(static_cast<int>(round(remainder/1024.0f)))+
|
||||
postfixes[group];
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> util::split_at(std::string_view view, char c) {
|
||||
size_t idx = view.find(c);
|
||||
if (idx == std::string::npos) {
|
||||
throw std::runtime_error(util::quote(std::string({c}))+" not found");
|
||||
}
|
||||
return std::make_pair(
|
||||
std::string(view.substr(0, idx)),
|
||||
std::string(view.substr(idx+1))
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue