MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / TIndexOf

Function TIndexOf

src/String.cpp:1269–1291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1267
1268template<typename T>
1269static int TIndexOf(int s, const T *str, int strLen, const T *sought, int soughtLen)
1270{
1271 if (soughtLen==1)
1272 {
1273 T test = *sought;
1274 while(s<strLen)
1275 {
1276 if (str[s]==test)
1277 return s;
1278 ++s;
1279 }
1280 }
1281 else
1282 {
1283 while(s+soughtLen<=strLen)
1284 {
1285 if (!memcmp(str + s,sought,soughtLen*sizeof(T)))
1286 return s;
1287 s++;
1288 }
1289 }
1290 return -1;
1291}
1292
1293static bool StrMatch(const char16_t *src0, const char *src1, int len)
1294{

Callers 1

indexOfMethod · 0.85

Calls 1

memcmpFunction · 0.50

Tested by

no test coverage detected