gpt4 book ai didi

Ruby,从字符串中删除最后 N 个字符?

转载 作者:数据小太阳 更新时间:2023-10-29 06:16:28 24 4
gpt4 key购买 nike

从字符串中删除最后 n 个字符的首选方法是什么?

最佳答案

irb> 'now is the time'[0...-4]
=> "now is the "

关于Ruby,从字符串中删除最后 N 个字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4209384/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com