| 1360 | |
| 1361 | |
| 1362 | int String::lastIndexOf(const String &inValue, Dynamic inStart) const |
| 1363 | { |
| 1364 | if (__s==0) |
| 1365 | return -1; |
| 1366 | int l = inValue.length; |
| 1367 | int s = inStart==null() ? length : inStart->__ToInt(); |
| 1368 | if (l==0) { |
| 1369 | return std::max(0, std::min(s, length)); |
| 1370 | } |
| 1371 | if (l>length) return -1; |
| 1372 | if (s+l>length) s = length-l; |
| 1373 | |
| 1374 | #ifdef HX_SMART_STRINGS |
| 1375 | bool s016 = isUTF16Encoded(); |
| 1376 | bool s116 = inValue.isUTF16Encoded(); |
| 1377 | if (s016 || s116) |
| 1378 | { |
| 1379 | if (s016 && s116) |
| 1380 | return TLastIndexOf(s, __w, length, inValue.__w, inValue.length); |
| 1381 | |
| 1382 | while(s>=0) |
| 1383 | { |
| 1384 | if (s016 ? StrMatch(__w+s, inValue.__s, l) : StrMatch(inValue.__w, __s+s, l) ) |
| 1385 | return s; |
| 1386 | s--; |
| 1387 | } |
| 1388 | return -1; |
| 1389 | } |
| 1390 | #endif |
| 1391 | return TLastIndexOf(s, __s, length, inValue.__s, inValue.length); |
| 1392 | } |
| 1393 | |
| 1394 | |
| 1395 |
no test coverage detected