FastPrepSplit Text by Multiple Delimiters
Problems/Split Text by Multiple Delimiters

Split Text by Multiple Delimiters

Rippling logoRippling● EasyNEW GRADONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The author clarifies that the onsite task splits text using different delimiters. Single-character delimiters, literal matching, empty-token handling, interface and bounds are practice conventions; core source match is about 75%.

You are given a string text and a string delimiters containing different separator characters. Split text wherever any character from delimiters appears.

Return the nonempty pieces in their original order. Treat delimiters literally, including characters that have special meanings in regular expressions. Do not trim spaces, change case, or otherwise change the contents of a piece. A space separates pieces only when it is itself a delimiter.

An empty delimiter string makes no cuts; an empty input string produces no tokens.

Function

splitByDelimiters(text: String, delimiters: String) → String[]

Examples

Example 1

text = "red,green;blue"delimiters = ",;"return = ["red","green","blue"]

Both comma and semicolon divide the text.

Example 2

text = ";a,,b;"delimiters = ",;"return = ["a","b"]

Leading, repeated and trailing delimiters do not create empty output tokens.

Example 3

text = "A.B+C"delimiters = ".+"return = ["A","B","C"]

The period and plus sign are literal separators, with no regular-expression meaning.

Constraints

  • 0 <= text.length <= 10000.
  • 0 <= delimiters.length <= 95; delimiter characters are distinct.
  • Both strings contain printable ASCII characters, from code point 32 through 126.

More Rippling problems

  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
All Rippling interview questionsSee Rippling hiring insights
Saved
public String[] splitByDelimiters(String text, String delimiters) {
    // Write your code here.
}
Checking account…