6 examples of 'javascript split on multiple characters' in JavaScript

Every line of 'javascript split on multiple characters' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
144function splitString(value) {
145 return value.split(/\s+/g);
146}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

157function splitString(string) {
158 return string.split(new RegExp(separators.join('|'), 'g'));
159}
284function split(str) {
285 var args = getArgs(arguments);
286 return stringProto.split.apply(str || '', args);
287}
8function split(val) {
9 return val.split(/\s+/);
10}
64splitString(str) {
65 try {
66 return str ? str.split(this.delimStr) : [];
67 }
68 catch (error) {
69 return str;
70 }
71}
190function splitString(str, ch) {
191 str = String(str);
192
193 var segs = str.split(ch);
194 var len = segs.length;
195 var res = [];
196 var i = -1;
197
198 while (++i < len) {
199 var key = segs[i];
200 while (key[key.length - 1] === '\\') {
201 key = key.slice(0, -1) + ch + segs[++i];
202 }
203 res.push(key);
204 }
205 return res;
206}

Related snippets