一组数字,如何用逗号隔开,并用0补充
再次先谢谢各位了。
比如有一组数字
69871052341
让他变成
06,09,08,07,10,05,02,03,04,01
数据源地址 www.pk10010.com/pk10/getHistoryData.do?count=1
option:{
host:"pk10010.com",
timeout:50000,
path: '/pk10/getHistoryData.do?count=1',
headers:{
"User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
}
},
parse:function(str){
try{
//console.log(str);return;
str=JSON.parse(str);
//var myDate = new Date();
//var year = myDate.getFullYear(); //年
//var month = myDate.getMonth() + 1; //月
//var day = myDate.getDate(); //日
//if(month < 10) month="0"+month;
//if(day < 10) day="0"+day;
//var mytime=year + "-" + month + "-" + day + " " +myDate.toLocaleTimeString();
//console.log(mytime);
return {
type:20,
time:str.rows[0].lotteryTime,
number:str.rows[0].termNum.replace(/(\d{8})(\d{3})/,'$1-$2'),
//number:str.next.periodNumberStr.replace(/(\d{8})(\d{3})/,'$1-$2'),
//data:str.rows[0].lotteryNum.replace(/(\d{1})(\d{1})(\d{1})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/,'$1,$2,$3,$4,$5,$6,$7,$8,$9,$10'),
data:str.rows[0].lotteryNum.split('').join(',')
};