Documentation can be found e.g. at MDN. Note that .split() is not a jQuery method, but a native string method.

If you use .split() on a string, then you get an array back with the substrings:

var str = 'something -- something_else';
var substr = str.split(' -- ');
// substr[0] contains "something"
// substr[1] contains "something_else"

If this value is in some field you could also do:

tRow.append($('<td>').text(=txtEntry2]').val().split(' -- ')[0])));

Answer from Felix Kling on Stack Overflow
🌐
W3Schools
w3schools.com › jsref › jsref_split.asp
JavaScript String split() Method
If (" ") is used as separator, the string is split between words. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › split
String.prototype.split() - JavaScript | MDN
The original string is: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" The separator is: "," The array has 12 elements: Jan / Feb / Mar / Apr / May / Jun / Jul / Aug / Sep / Oct / Nov / Dec · In the following example, split() looks for zero or more spaces, followed by a semicolon, followed by zero or more spaces—and, when found, removes the spaces and the semicolon from the string.
🌐
Medium
medium.com › nerd-for-tech › basics-of-javascript-string-split-method-4647aa1b0f4e
Basics of Javascript · String · split() (method) | by Jakub Korch | Nerd For Tech | Medium
June 20, 2021 - On the other hand, if an empty string (“”) is used as the separator, the string is split between each character. Second parameter is an integer number that specifies the amount of splits. Items after the split limit will not be included in the resulting array. Let’s see how it works in example 1.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-split-method
JavaScript String split() Method - GeeksforGeeks
It returns an array and does not change the original string. An optional limit parameter can be used to control the number of splits. ... separator: It is used to specify the character, or the regular expression, to use for splitting the string. If the separator is unspecified then the entire string becomes one single array element.
Published   January 16, 2026
🌐
Sentry
sentry.io › sentry answers › javascript › split a string in javascript
Split a string in JavaScript | Sentry
const myString = "This is a sentence."; const words = myString.split(/(?= )/); // split on but retain single space characters console.log(words); // will output ["This", " is", " a", " sentence."]
🌐
CoreUI
coreui.io › answers › how-to-split-a-string-by-spaces-in-javascript
How to split a string by spaces in JavaScript · CoreUI
September 23, 2025 - In this example, 'hello world javascript'.split(' ') produces ['hello', 'world', 'javascript']. This method preserves the original words exactly as they appear, including any punctuation attached to them.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › javascript-string-split-example-with-regex
JavaScript String.Split() Example with RegEx
May 26, 2022 - The split method uses characters that match this pattern as a breakpoint, and as you can see, the "$e" in "$everything" and the "$o" in "g$oing" served as a breakpoint to split the string into substrings.
🌐
Built In
builtin.com › software-engineering-perspectives › split-string-javascript
How to Split a String in JavaScript | Built In
Summary: The JavaScript split() method divides a string into an array of substrings using a specified delimiter. It can be used for tasks like parsing CSV data, extracting URL components or reversing strings, and supports an optional limit on the number of splits.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-split-how-to-split-a-string-into-an-array-in-js
JavaScript Split – How to Split a String into an Array in JS
June 16, 2021 - There could be cases where you may have passed a splitter that is not part of the string or doesn't match any part of it. In that case, the split() method returns an array with the entire string as an element. In the example below, the message string doesn't have a comma (,) character.
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › String › split
JavaScript String split() - Divide String Into Array | Vultr Docs
November 11, 2024 - This example uses a regex pattern to split the mixedContent string at each sequence of digits. It's useful for extracting text separated by varying numbers of digits. The JavaScript split() function is an incredibly powerful tool for string ...
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript string methods › string.prototype.split()
JavaScript String split(): Splitting a String into Substrings
November 3, 2024 - In this tutorial, you'll learn how to use the JavaScript split() method to split a string into an array of substrings.
🌐
ReqBin
reqbin.com › code › javascript › wyqvcilw › javascript-split-string-example
How do I split a string in JavaScript?
February 10, 2023 - The following is an example of splitting a string by capital letters using the split() method and specifying a Regular Expression as the delimiter: JavaScript Split Strings by Capital Letters Example
🌐
Programiz
programiz.com › javascript › library › string › split
JavaScript String split()
// divides the message string at :: let result = message.split("::"); console.log(result); // Output: [ 'JavaScript', 'is', 'fun' ]
🌐
Unibo
www-db.disi.unibo.it › courses › TW › DOCS › w3schools › jsref › jsref_split.asp.html
JavaScript String split() Method
More "Try it Yourself" examples below. The split() method is used to split a string into an array of substrings, and returns the new array.
🌐
DEV Community
dev.to › tpointtech123 › a-guide-to-splitting-strings-in-javascript-by-regex-4hg3
A Guide to Splitting Strings in JavaScript by Regex - DEV Community
March 20, 2025 - Splitting Strings in JavaScript using regular expressions (regex) is a powerful technique for handling text data. The split() method allows developers to divide strings based on complex patterns, such as whitespace, punctuation, or digits, making it more versatile than simple string delimiters.
🌐
W3Schools
w3schools.com › java › ref_string_split.asp
Java String split() Method
The last element of the array will contain the remainder of the string, which may still have separators in it if the limit was reached. Tip: See the Java RegEx tutorial to learn about regular expressions. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
DEV Community
dev.to › dillionmegida › string-split-in-javascript-2a0d
String.split() in Javascript - DEV Community
April 19, 2020 - const str = 'String.split() in 1b in 1c in Javascript article' const regex = /\d{1}.{1}/ const pieces = str.split(regex); console.log(pieces) // Expected output // [ 'String.split() in ', ' in ', ' in Javascript article' ]
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String
String - JavaScript | MDN
You must be careful which level of characters you are iterating on. For example, split("") will split by UTF-16 code units and will separate surrogate pairs. String indexes also refer to the index of each UTF-16 code unit. On the other hand, [Symbol.iterator]() iterates by Unicode code points.