[英]Turning a text string of week numbers into array of values with jquery
I've been battling with this for a while: 我已经为此战斗了一段时间:
I've got a mysql database of events happening on various weeks. 我有一个在各个星期发生的事件的mysql数据库。 For each event there is a field with the week numbers that it is occurring as a text string.
对于每个事件,都有一个字段,其中包含作为文本字符串出现的星期数。
eg W01-W04, W06, W08, W10
例如
W01-W04, W06, W08, W10
How can i convert that that to an array of values with jquery? 我如何使用jQuery将其转换为值数组?
eg W01, W02, W03, W04 ect..
例如
W01, W02, W03, W04 ect..
And then how would i replace that row with a row for each week value. 然后我将如何用该行替换每个星期的值。
Thanks in advanced. 先谢谢了。
只需在JavaScript字符串上使用.split()
方法即可:
string.split(',');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.