67 auto commaPos = NPCDispIdstr.find(
',');
68 if (commaPos != std::string::npos)
69 NPCDispIdstr = NPCDispIdstr.substr(0, commaPos);
71 const int NPCDispId = std::stoi(NPCDispIdstr);
75 result->
name = std::wstring(NPCName.begin(), NPCName.end());
76 result->
type = NPCType;
124 auto findCI = [](
const std::string& haystack,
const std::string& needle,
size_t pos) ->
size_t {
125 auto it = std::search(haystack.begin() + pos, haystack.end(),
126 needle.begin(), needle.end(),
127 [](
char a,
char b) { return std::tolower(static_cast<unsigned char>(a)) == std::tolower(static_cast<unsigned char>(b)); });
128 return (it == haystack.end()) ? std::string::npos :
static_cast<size_t>(it - haystack.begin());
131 size_t beginIdx = findCI(datas, beginPattern, 0);
132 if (beginIdx == std::string::npos)
135 beginIdx += beginPattern.size();
136 std::string result = datas.substr(beginIdx);
138 if (!endPattern.empty())
140 size_t endIdx = findCI(result, endPattern, 0);
141 if (endIdx != std::string::npos)
142 result = result.substr(0, endIdx);