【发布时间】:2016-02-22 11:38:44
【问题描述】:
我有一个从后端服务器获取的数组。但我想使用'ul'将该数组转换为list。如何使用regexp 清理数组并将它们转换为单个清除数组?
这是我得到的数据:
[
"1. Submittals in progress\n2. Structural works in progress in S2 & S3\n3. Structural works in progress in N4.\n4. Childrens Mall pedestal and steel fabrication.",
"",
"1. Procurement of activities in progress.\n2. External works for mist pool in progress\n3. MEP 1st & 2nd fix in progress\n4. Block work and grade slab in progress "
]
结果应该是:(有一个标记为\n 用于休息。以及empty 两个数组之间的字符串。
var array = [
"Procurement of activities in progress.",
"Structural works in progress in S2 & S3",
"Structural works in progress in N4.",
"Childrens Mall pedestal and steel fabrication."
"Procurement of activities in progress."
"External works for mist pool in progress",
"MEP 1st & 2nd fix in progress",
"Block work and grade slab in progress"
]
【问题讨论】:
-
你有文字
\n还是只是换行符? -
我们可以将其视为换行
标签: javascript jquery arrays regex