%% was not handled properly
This commit is contained in:
parent
7826ab0b84
commit
e4efdf79e5
@ -85,12 +85,24 @@ String.prototype.L = function( ...args )
|
|||||||
var a = 0;
|
var a = 0;
|
||||||
while( ~( j = this.indexOf( "%s", i ) ) )
|
while( ~( j = this.indexOf( "%s", i ) ) )
|
||||||
{
|
{
|
||||||
i = j + 2;
|
// handle %% => % literal
|
||||||
|
if( this[ j - 1 ] == "%" )
|
||||||
|
{
|
||||||
|
// How many % in a row?
|
||||||
|
var nump = -1;
|
||||||
|
while( this[ j + ( -- nump ) ] == "%" );
|
||||||
|
|
||||||
// %% => % literal
|
// If number of percent is even, this %s is escaped
|
||||||
if( this[ j - 1 ] == "%" ) continue;
|
if( nump % 2 == 0 )
|
||||||
|
{
|
||||||
|
i ++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
str += this.substring( i, j ) + args[ a ++ ];
|
str += this.substring( i, j ) + args[ a ++ ];
|
||||||
|
|
||||||
|
i = j + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( str == "" ) return this.replace( "%%", "%" );
|
if( str == "" ) return this.replace( "%%", "%" );
|
||||||
|
Loading…
Reference in New Issue
Block a user