将逗号分隔值存储到数组中 [英] Store comma separate values into array
本文介绍了将逗号分隔值存储到数组中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将逗号分隔值存储到数组中。
后来我想用不同的支票检查。
I want to store comma separate values into array. Later i want check it with different check.
var_str= name,address,state,city // I want make array from this variable
我怎么能这样做...
How could i do this...
谢谢..
推荐答案
(假设你有一个字符串并希望将其转换为数组)字符串上的拆分方法拆分分隔符上的字符串。
(Assuming that you have a string and want to convert it to an array)Split method on strings splits strings on a separator.
var str = "name,address,state,city";
var arr = str.split(',');
这篇关于将逗号分隔值存储到数组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文