gpt4 book ai didi

dart - 删除字符串中的尾部斜杠

转载 作者:行者123 更新时间:2023-12-03 04:01:27 24 4
gpt4 key购买 nike

有些用户输入 https://google.com/,有些用户输入 https://google.com

如何检查用户输入是否带有斜线?如果用户输入带有斜杠 如何删除斜杠?

最佳答案

var str = 'https://google.com/';
if (str.endsWith('/')) str = str.substring(0, str.length - 1);

关于dart - 删除字符串中的尾部斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56145759/

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