About 399 results
Open links in new tab
  1. Java String split() Method - W3Schools

    The split() method splits a string into an array of substrings using a regular expression as the separator. If a limit is specified, the returned array will not be longer than the limit. 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.

  2. JavaScript String split() Method - W3Schools

    The split() method splits a string into an array of substrings. The split() method returns the new array. The split() method does not change the original string.

  3. Java String split() Method - GeeksforGeeks

    Apr 11, 2025 · The String split() method in Java is used to split a string into an array of substrings based on matches of the given regular expression or specified delimiter. This method returns a string array containing the required substring.

  4. String.prototype.split() - JavaScript | MDN - MDN Web Docs

    Apr 3, 2025 · The split() method of String values takes a pattern and divides this string into an ordered list of substrings by searching for the pattern, puts these substrings into an array, and returns the array.

  5. How do I split a string in Java? - Stack Overflow

    Nov 20, 2016 · Use org.apache.commons.lang.StringUtils' split method which can split strings based on the character or string you want to split. Method signature: public static String[] split(String str, char separatorChar); In your case, you want to split a string when there is a "-". You can simply do as follows:

  6. Java String split() - Programiz

    The Java String split() method divides the string at the specified separator and returns an array of substrings. In this tutorial, you will learn about the Java split() method with the help of examples.

  7. java - How to split a comma-separated string? - Stack Overflow

    May 17, 2012 · use method split ("spliting char") it splits your string nad method will create string-array with splitted words. You could do this: String str = "..."; In Java 9+, create an unmodifiable list with List.of. List<String> elephantList = List.of(str.split(", ")); // Unmodifiable list.

  8. Java String split() Method with examples - BeginnersBook

    Dec 1, 2024 · Java String split method is used for splitting a String into substrings based on the given delimiter or regular expression. For example: Regular Expression: @ Output Substrings: {"chaitanya", "singh"} We have two variants of split() method in String class. 1.

  9. Split a String in Java - Baeldung

    Jan 8, 2024 · We can split a string into two parts by getting its midpoint and using substring() to get the separated parts. Here’s an example that splits a string in half: String hello = "Baeldung"; int mid = hello.length() / 2; String[] parts = { hello.substring(0, mid), hello.substring(mid) };

  10. JavaScript String split(): Splitting a String into Substrings

    Summary: in this tutorial, you’ll learn how to use the JavaScript split() method to split a string into an array of substrings. The String.prototype.split() splits a string into an array of substrings: The split() accepts two optional parameters: separator and limit. 1) separator.