如何用逗号分割数据 [英] How to split data with comma
本文介绍了如何用逗号分割数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用逗号分割数据,但它没有分割
我尝试过:
我试图拆分这个sanjay,sanjay @ gmail.com,999-999-9999
这个我正在使用此代码
I am trying to split data with have comma but it does not split
What I have tried:
I am try to split this "sanjay,sanjay@gmail.com",999-999-9999
for this i am using this code
var refrence = sanjay,sanjay@gmail.com,999-999-9999
var refrence = o.data[i].Refrence1;
var getref = refrence.split(",");
for (var i = 0; i < getref.length; i++)
{
vrList += getref[i]+'<br />';
}
推荐答案
首先,你所要做的就是调试,你会看到问题所在。非常简单。
其次,在初始字符串周围加上引号。
Firstly, all you have to do is debug and you'll see the problem. Very easy.
Second, put quotes around your initial string.
var refrence = "sanjay,sanjay@gmail.com,999-999-9999";
第三,使用不同的变量名称。然后,下一行覆盖参考文献。
Third, use a different variable name. The next line you then overwrite what was in refrence.
这篇关于如何用逗号分割数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文