js截取指定字符串

let urlsParams = 'https://dataapi.ppkao.com/api/MarketMemberListApi/EditUserFinanceInfo&source=api_pc&sign=94e8d75a2f0681db0e9b8be0b2605e13';

//用search()方法查找字符串'sign' ,会返回s的位置

let signIndex = urlsParams.search(/sign/);
console.log(signIndex);//84

//截取sign 及以后字符串
let sign = urlsParams.substring(signIndex);

console.log(sign);//sign=94e8d75a2f0681db0e9b8be0b2605e13

 

你可能感兴趣的:(JavaScript基础,ES6)