function toRope(s) { try { return newRope(s[0], s.substring(1));
} catch {} // newRope can fail when |s| fits into an inline string. In that case simply // return the input. return s;
}
for (let i = 0; i <= 32; ++i) {
let strings = [ascii, latin1, twoByte].flatMap(codePoints => [
String.fromCodePoint(...codePoints.slice(0, i)),
// Leading ASCII upper case character. "A" + String.fromCodePoint(...codePoints.slice(0, i)),
// Leading ASCII lower case character. "a" + String.fromCodePoint(...codePoints.slice(0, i)),
// Leading Latin-1 upper case character. "À" + String.fromCodePoint(...codePoints.slice(0, i)),
// Leading Latin-1 lower case character. "à" + String.fromCodePoint(...codePoints.slice(0, i)),
// Leading Two-Byte upper case character. "Ā" + String.fromCodePoint(...codePoints.slice(0, i)),
// Leading Two-Byte lower case character. "ā" + String.fromCodePoint(...codePoints.slice(0, i)),
]).flatMap(x => [
x,
toRope(x),
newString(x, {twoByte: true}),
]);
const expected = strings.map(x => { // Prevent Warp compilation when computing the expected results.
with ({}) ; return x.toTitleCase();
});
for (let i = 0; i < 1000; ++i) {
let idx = i % strings.length;
let str = strings[idx];
let actual = str.toTitleCase(); if (actual !== expected[idx]) thrownew Error();
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
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.