Back to Type Challenges

README

questions/04803-medium-trim-right/README.md

latest2.0 KB
Original Source
<!--info-header-start--><h1>Trim Right </h1><blockquote><p>by Yugang Cao <a href="https://github.com/Talljack" target="_blank">@Talljack</a></p></blockquote><p><a href="https://tsch.js.org/4803/play" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

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

For example:

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

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