[Patches] Add custom patches & fix MP4 patch
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
std::string TrimString(const std::string& str, const std::string& whitespace)
|
||||
{
|
||||
const size_t strBegin = str.find_first_not_of(whitespace);
|
||||
|
||||
if (strBegin == std::string::npos)
|
||||
return "";
|
||||
|
||||
const size_t strEnd = str.find_last_not_of(whitespace);
|
||||
const size_t strRange = strEnd - strBegin + 1;
|
||||
|
||||
return str.substr(strBegin, strRange);
|
||||
}
|
||||
|
||||
std::vector<std::string> SplitString(const std::string& str, const std::string& delim)
|
||||
{
|
||||
std::vector<std::string> tokens;
|
||||
size_t prev = 0, pos = 0;
|
||||
do
|
||||
{
|
||||
pos = str.find(delim, prev);
|
||||
if (pos == std::string::npos)
|
||||
pos = str.length();
|
||||
|
||||
std::string token = str.substr(prev, pos - prev);
|
||||
|
||||
if (!token.empty())
|
||||
tokens.push_back(token);
|
||||
|
||||
prev = pos + delim.length();
|
||||
} while (pos < str.length() && prev < str.length());
|
||||
|
||||
return tokens;
|
||||
}
|
||||
Reference in New Issue
Block a user