gpt4 book ai didi

JavaScript : Replace all character by empty after a specific character

转载 作者:行者123 更新时间:2023-11-29 21:58:31 27 4
gpt4 key购买 nike

我有这个字符串:

var test = "toto@test.com";

我想用空值替换“@”字符后的所有字符。我想得到这个字符串:

var test = "toto"

最佳答案

试试这个:

test= test.split('@')[0]

关于JavaScript : Replace all character by empty after a specific character,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25157499/

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