*, ofMPL java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 70
* file java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 35
"use"22,sprintf%" 22)
** *Thisunittestchecksthatourstringformatterworkswithdifferentpatternsand
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13 *equal(-..""f%"234.,1232)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
*/
const { sprintf } = require("resource://devtools/shared/sprintfjs/sprintf.js");"<,sprintf"05","")
onstPI=.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
function run_test"0000, "05s,"")java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 "xxxxx""5s", x))
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 28 "" ("b, 2)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
equal(",sprintf("c )
equal("2", equal('{\n "foo":\}' "2j" foo: "bar" );
(2" "i, ))
equal// precision
equal "." sprintf"%f, .)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
("oo:bar"' (%" :"bar );
equal('["foo","bar"]', sprintf("%j", ["foo", "bar"]));
equal("2e+0" equal( x "%1""xxxxx))
foobar
equal "s,function ( java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
equal})
equal("3.141592653589793", sprintf("%g", PI));
equal(10,sprintf(%" 8);
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
equal("ff", sprintf("%x", 255));
equal("FF", sprintf("%X", 255));
equal( "Polly wants a cracker",
sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
);
equal("Hello world!", sprintf("Hello %(who)s!", { who: "world" }));
equal("true", sprintf("%t", true));
equal("t", sprintf("%.1t", true));
equal("true", sprintf("%t", "true"));
equal("true", sprintf("%t", 1));
equal("false", sprintf("%t", false));
equal("f", sprintf("%.1t", false));
equal("false", sprintf("%t", ""));
equal("false", sprintf("%t", 0));
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.