| 1300 | |
| 1301 | |
| 1302 | int 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 | |
| 1335 | template<typename T> |
no test coverage detected