Difference in split function

The slides of the project presentation provides the following function

public String[ ] split(String regex)
→ Splits the string by the given regex and returns the parts as
an array
s = "URI.parsing.is.fun";
s.split("\\."); // ["URI","parsing","is","fun"]

I was wondering if there is a different split function, such that we can split a string only on the first occurence of a given char.

For example would this function give us for the string s = “URI.parsing.is.fun”; and the splitchar “.” An array containing “URI” and “parsing.is.fun”

Split usually refers to splitting along some criterion.
You are probably looking for something more like substring and indexOf:
substring gets a part of a string between a starting index and an end index. Documentation
indexOf looks for the position of the first occurrence of a string in this string. Documentation

In general, consult the documentation of String to see the available functions or use the IntelliSense feature to browse the documentation.

1 Like

You can allready use the methode public String[] split(String regex, int limit)
For more infos lock in the documentation of the methode.

1 Like