我有正在打印的字符串:
$string = "winter coats gloves hats blankets sleeping bags tarps milk magnesia shoes boots art";
我需要将正则表达式转换为字符串数组,例如:
$newString = array ('winter','coats','gloves','hats','blankets','sleeping','bags','tarps','milk','magnesia','shoes','boots','art');
面临的挑战是,如何在每端添加'
,而','
替换空格......
到目前为止,我有这个,这不起作用......
$string = str.replace(/\s+/g, '','',$string);