分割多个字符的问题

时间:2020-03-12 11:16:56

标签: javascript split

我有类似

的句子

现金为王。在您准备会计计划的那一天,我确定您会仔细草拟会计标准,并且我们的帐目不需要装扮得很漂亮。先生,您写旁白。

我想用?.来分隔这句话

我曾经用过

var words= 'Cash is king. The day you prepared the accounting plan, I was sure that you will draft the accounting standards carefully and our accounts will not be required to be window dressed. Sir you write the narration.';
var split = words.split(".");

console.log(split);

它正在工作,但是我想同时用?.拆分句子。我该怎么办?

有人可以帮我吗

1 个答案:

答案 0 :(得分:1)

您可以使用 Container box = getContentPane(); box.setLayout(null); box.add(combo = new JComboBox()); combo.setModel(new DefaultComboBoxModel(new String[] {"First Name", "Middle Name", "Last Name", "Username"})); combo.setBounds(410, 85, 100, 30); combo.setSelectedItem(null); 的正则表达式格式同时在?.上进行拆分,即:

.split()

示例片段:

words.split(/[?.]/)