【发布时间】:2018-08-15 03:53:03
【问题描述】:
在我的 Angular 5 项目中,我使用打字稿在这样的字符串上使用 .trim() 函数,但它没有删除空格,也没有给出任何错误。
this.maintabinfo = this.inner_view_data.trim().toLowerCase();
// inner_view_data has this value = "Stone setting"
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-4.html 这个文档清楚地说.trim() 是打字稿的一部分。
从打字稿中的字符串中删除空格的最佳方法是什么?
【问题讨论】:
-
试试
.toString().trim()
标签: angular typescript trim