We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url有三种情况 https://www.xx.cn/api?keyword=&level1=&local_batch_id=&elective=&local_province_id=33 https://www.xx.cn/api?keyword=&level1=&local_batch_id=&elective=800&local_province_id=33 https://www.xx.cn/api?keyword=&level1=&local_batch_id=&elective=800,700&local_province_id=33
匹配elective后的数字输出(写出你认为的最优解法): [] || ['800'] || ['800','700']
[] || ['800'] || ['800','700']
解答: 法一:
function getUrlValue(url){ if(!url) return; let res = url.match(/(?<=elective=)(\d+(,\d+)*)/); return res ?res[0].split(',') : []; }
法二:(IE 不支持)
function getParamsUrl(url) { var res = new URLSearchParams(url).get('elective'); return res ? res.split(',') : []; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
url有三种情况
https://www.xx.cn/api?keyword=&level1=&local_batch_id=&elective=&local_province_id=33
https://www.xx.cn/api?keyword=&level1=&local_batch_id=&elective=800&local_province_id=33
https://www.xx.cn/api?keyword=&level1=&local_batch_id=&elective=800,700&local_province_id=33
匹配elective后的数字输出(写出你认为的最优解法):
[] || ['800'] || ['800','700']
解答:
法一:
法二:(IE 不支持)
The text was updated successfully, but these errors were encountered: