字符串去掉最后一个字符

字符串去掉最后一个字符

let str: string = "hello world";
str = str.slice(0, -1); // "hello worl"

let str: string = "hello world";
str = str.substring(0, str.length - 1); // "hello worl"
posted @ 2023-04-28 14:26  yjxQWQ  阅读(64)  评论(0)    收藏  举报