mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-15 03:03:50 +00:00
sprintf and related functions support for "%@" format specifier
This commit is contained in:
1 parent
c6a2d55821
commit
abe4dd7abc
1 file changed
+3
-3
@@ -620,8 +620,8 @@ String.prototype.isa = CPString;
|
||||
|
||||
// sprintf:
|
||||
|
||||
var sprintfFormatRegex = new RegExp("([^%]+|%[\\+\\-\\ \\#0]*[0-9\\*]*(.[0-9\\*]+)?[hlL]?[cdieEfgGosuxXpn%])", "g");
|
||||
var sprintfTagRegex = new RegExp("(%)([\\+\\-\\ \\#0]*)([0-9\\*]*)((.[0-9\\*]+)?)([hlL]?)([cdieEfgGosuxXpn%])");
|
||||
var sprintfFormatRegex = new RegExp("([^%]+|%[\\+\\-\\ \\#0]*[0-9\\*]*(.[0-9\\*]+)?[hlL]?[cdieEfgGosuxXpn%@])", "g");
|
||||
var sprintfTagRegex = new RegExp("(%)([\\+\\-\\ \\#0]*)([0-9\\*]*)((.[0-9\\*]+)?)([hlL]?)([cdieEfgGosuxXpn%@])");
|
||||
|
||||
/*
|
||||
Creates a new string using C printf-style formatting. First argument should be a constant format string, like ' "float val = %f" ', remaining arguments should be the variables to print the values of, comma-separated.
|
||||
@@ -750,7 +750,7 @@ function sprintf(format)
|
||||
subresult = "%";
|
||||
else if (specifier == "c")
|
||||
subresult = String(arguments[arg++]).charAt(0);
|
||||
else if (specifier == "s")
|
||||
else if (specifier == "s" || specifier == "@")
|
||||
subresult = String(arguments[arg++]);
|
||||
else if (specifier == "p" || specifier == "n")
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user