Back to Type Challenges

README

questions/00106-medium-trimleft/README.md

latest2.1 KB
Original Source
<!--info-header-start--><h1>Trim Left </h1><blockquote><p>by Anthony Fu <a href="https://github.com/antfu" target="_blank">@antfu</a></p></blockquote><p><a href="https://tsch.js.org/106/play" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

Implement TrimLeft<T> which takes an exact string type and returns a new string with the whitespace beginning removed.

For example

ts
type trimmed = TrimLeft<'  Hello World  '> // expected to be 'Hello World  '
<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/106/answer" target="_blank"></a> <a href="https://tsch.js.org/106/solutions" target="_blank"></a> <hr><h3>Related Challenges</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00108-medium-trim/README.md" target="_blank"></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/04803-medium-trim-right/README.md" target="_blank"></a> <!--info-footer-end-->