bool TestExtString::test_strpos() { VS(f_strpos("abcdef abcdef", "a"), 0); VS(f_strpos("abcdef abcdef", "a", 1), 7); VS(f_strpos("abcdef abcdef", "A", 1), false); VS(f_strpos("abcdef abcdef", "", 0), false); return Count(true); }
Variant f_strstr(CStrRef haystack, CVarRef needle) { Variant ret = f_strpos(haystack, needle); if (same(ret, false)) { return false; } return haystack.substr(ret.toInt32()); }