Back to Type Challenges

README

questions/02822-hard-split/README.md

latest1.5 KB
Original Source
<!--info-header-start--><h1>Split </h1><blockquote><p>by Andrea Simone Costa <a href="https://github.com/jfet97" target="_blank">@jfet97</a></p></blockquote><p><a href="https://tsch.js.org/2822/play" target="_blank"></a> </p><!--info-header-end-->

The well known split() method splits a string into an array of substrings by looking for a separator, and returns the new array. The goal of this challenge is to split a string, by using a separator, but in the type system!

For example:

ts
type result = Split<'Hi! How are you?', ' '>  // should be ['Hi!', 'How', 'are', 'you?']
<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/2822/answer" target="_blank"></a> <a href="https://tsch.js.org/2822/solutions" target="_blank"></a> <!--info-footer-end-->