Back to Type Challenges

README.Zh CN

questions/00106-medium-trimleft/README.zh-CN.md

latest2.4 KB
Original Source
<!--info-header-start--><h1>去除左侧空白 </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/zh-CN" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

实现 TrimLeft<T> ,它接收确定的字符串类型并返回一个新的字符串,其中新返回的字符串删除了原字符串开头的空白字符串。

例如

ts
type trimmed = TrimLeft<'  Hello World  '> // 应推导出 'Hello World  '
<!--info-footer-start-->

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