function toLatin1(s) {
assertEq(isLatin1(s), true); return s;
} function testLastIndexOf() { var s1 = toLatin1("abcdefgh123456\u0081defg"); var s2 = toLatin1("456\u0081de");
function testIndexOfBMH() { // BoyerMooreHorspool algorithm is used for large strings. var s = "012345678901234567890123456789".repeat(20); var text = s + "abcdefghijklmnopqrst\u00C1uvwxyz";
text.indexOf("333");
var textL1 = toLatin1(text); var patL1 = toLatin1("cdefghijklmnopqrst\u00C1uvwx");
function testIndexOfLargePattern() { // If the pattern length > 128, memcmp is used (text length has to be < 512 // or we'll use BoyerMooreHorspool). This is only valid if both // strings have the same encoding. var text = "012345678901234567890123456789".repeat(10) + "abcdefghijklmnopqrst\u00C1uvwxyz";
text.indexOf("333"); // flatten var pat = "012345678901234567890123456789".repeat(5) + "abcdefghijklmnopqr";
pat.indexOf("333"); // flatten
// Latin1 + Latin1
text = toLatin1(text);
pat = toLatin1(pat);
assertEq(text.indexOf(pat), 150);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.