JavaScript字符串转数组:将逗号分隔的字符串转换成数组
可以使用split()方法将字符串按照指定的分隔符转换成数组,代码如下:
var str = '/Attached/2023/6/25/202362515349.jpg,/Attached/2023/6/25/202362515351.jpg';
var arr = str.split(',');
console.log(arr);
运行结果为:
['/Attached/2023/6/25/202362515349.jpg', '/Attached/2023/6/25/202362515351.jpg']
原文地址: https://www.cveoy.top/t/topic/oUxV 著作权归作者所有。请勿转载和采集!