忽然有人问我如何替换"2004-9-6" -> "2004-09-06"。
想了一会,发现技能放久了不用会生锈地。
var theDateString = "2004-9-6";
theDateString = theDateString.replace(/-(\d{1})(?=-|$)/g, "-0$1");
A scientist builds in order to learn; an engineer learns in order to build.
想了一会,发现技能放久了不用会生锈地。
var theDateString = "2004-9-6";
theDateString = theDateString.replace(/-(\d{1})(?=-|$)/g, "-0$1");