MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / indexOf

Method indexOf

framework/utils/af_string.cpp:233–252  ·  view source on GitHub ↗

binary search in memory */

Source from the content-addressed store, hash-verified

231
232/* binary search in memory */
233int AfString::indexOf(const char *hay, int haysize, const char *needle, int needlesize)
234{
235 int haypos, needlepos;
236 haysize -= needlesize;
237
238 for (haypos = 0; haypos <= haysize; haypos++) {
239 for (needlepos = 0; needlepos < needlesize; needlepos++) {
240 if (hay[haypos + needlepos] != needle[needlepos]) {
241 // Next character in haystack.
242 break;
243 }
244 }
245
246 if (needlepos == needlesize) {
247 return haypos;
248 }
249 }
250
251 return -1;
252}
253
254std::map<std::string, std::string> AfString::keyValueToMap(const std::string &source, const std::string &splitStr)
255{

Callers 3

requestKeyMethod · 0.80
parseOverrideStyleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected