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

Method indexOf

src/String.cpp:1302–1332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1300
1301
1302int String::indexOf(const String &inValue, Dynamic inStart) const
1303{
1304 if (__s==0)
1305 return -1;
1306 int s = inStart==null() ? 0 : inStart->__ToInt();
1307 int l = inValue.length;
1308
1309 if (l==0) {
1310 return std::max(0, std::min(s, length));
1311 }
1312
1313 #ifdef HX_SMART_STRINGS
1314 bool s016 = isUTF16Encoded();
1315 bool s116 = inValue.isUTF16Encoded();
1316 if (s016 || s116)
1317 {
1318 if (s016 && s116)
1319 return TIndexOf(s, __w, length, inValue.__w, inValue.length);
1320
1321 while(s+l<=length)
1322 {
1323 if (s016 ? StrMatch(__w+s, inValue.__s, l) : StrMatch(inValue.__w, __s+s, l) )
1324 return s;
1325 s++;
1326 }
1327 return -1;
1328 }
1329 #endif
1330
1331 return TIndexOf(s, __s, length, inValue.__s, inValue.length);
1332}
1333
1334
1335template<typename T>

Callers 9

runIndexOfMethod · 0.80
addScriptableClassFunction · 0.80
addScriptableFileFunction · 0.80
runIntMethod · 0.80
runIndexMethod · 0.80
runIntMethod · 0.80
runIndexOfMethod · 0.80

Calls 7

maxFunction · 0.85
minFunction · 0.85
isUTF16EncodedFunction · 0.85
TIndexOfFunction · 0.85
StrMatchFunction · 0.85
nullClass · 0.50
__ToIntMethod · 0.45

Tested by

no test coverage detected