字符串的方法--不影响原数据

去除两端空格trim 分割split 转大写toUppercase 转小写toLowercase 包含includes 找下标indexof

以固定元素开头startWith 以固定元素结尾endWith 找最后一个元素下标lastindexof

去除某一项charAt/at 往前补充padStart 后面补充padEnd 合并concat 截取slice/substr 匹配match 重复repeat 替换replace

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐