Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我遇到的问题的性质如下所述:
我有这样的字符串radiobutton1_2_3_4或imagelist_1_34_54
radiobutton1_2_3_4
imagelist_1_34_54
我想要做的是抓住第三个下划线(_)之后的所有内容。
id.substring(id.indexOf('_')我试过了,但在我的情况下它没有用。
id.substring(id.indexOf('_')
问候
如果它始终是您可以使用的最后一个下划线id.substring(id.lastIndexOf('_')),否则id.split('_')[3]应该可以使用。
id.substring(id.lastIndexOf('_'))
id.split('_')[3]
var split = id.split('_'); var a = split[1], b = split[2], c = split[3];
这会将您的三个数字存储在 a,b,c 中
我正在尝试允许用户使用 Stripe 在我的应用中添加信用卡。当我调用下面的代码(来自文档:https ://stripe.com/docs/api#create_card )时,我收到以下错误。
是文档过时了还是我做错了什么?