Allow size-specific resizers
[jpcrr.git] / streamtools / misc.cpp
blob1415ae46780ee9ccfed13693d3411d35b8a08a67
1 #include "misc.hpp"
2 #include <stdexcept>
4 bool isstringprefix(const std::string& full, const std::string& prefix)
6 if(prefix.length() > full.length())
7 return false;
8 for(size_t i = 0; i < prefix.length(); i++)
9 if(full[i] != prefix[i])
10 return false;
11 return true;
14 std::string settingvalue(const std::string& setting)
16 size_t x;
17 std::string _setting = setting;
18 x = _setting.find_first_of("=");
19 if(x > _setting.length())
20 throw std::runtime_error("Invalid setting syntax");
21 else
22 return _setting.substr(x + 1);