js --> obj2str
来源:互联网 发布:我的体育老师卫视网络 编辑:程序博客网 时间:2024/06/08 07:14
function obj2str(o){
var r = [];
if(typeof o == "string" || o == null) {
return o;
}
if(typeof o == "object"){
if(!o.sort){
r[0]="{"
for(var i in o){
r[r.length]=i;
r[r.length]=":";
r[r.length]=obj2str(o[i]);
r[r.length]=",";
}
r[r.length-1]="}"
}else{
r[0]="["
for(var i =0;i<o.length;i++){
r[r.length]=obj2str(o[i]);
r[r.length]=",";
}
r[r.length-1]="]"
}
return r.join("");
}
return o.toString();
}
var r = [];
if(typeof o == "string" || o == null) {
return o;
}
if(typeof o == "object"){
if(!o.sort){
r[0]="{"
for(var i in o){
r[r.length]=i;
r[r.length]=":";
r[r.length]=obj2str(o[i]);
r[r.length]=",";
}
r[r.length-1]="}"
}else{
r[0]="["
for(var i =0;i<o.length;i++){
r[r.length]=obj2str(o[i]);
r[r.length]=",";
}
r[r.length-1]="]"
}
return r.join("");
}
return o.toString();
}
- js --> obj2str
- js
- js
- JS
- JS
- JS
- js
- js
- js
- js
- js
- JS
- js
- JS
- js
- js
- js
- js
- 机器如何区分和判定指令和数据
- 解决SVN unable to load defalut SVN client错误
- iOS Block学习
- Objective-C数组小结
- dg主备库切换步骤
- js --> obj2str
- 字符串是否包含及匹配/查找/转换/拷贝问题
- try中的return与finally执行的顺序
- python 的 @property
- [已解决]如何使用批处理添加受限制网站
- 深入Java事务的原理与应用
- vc中载入flash资源
- JS美化对话框
- 21 Laws of Computer Programming