如何删除放大器;来自 URL
How to remove amp; from URL
我得到一个包含 amp;
的 URL。有没有什么方法可以删除它,因为我目前尝试使用 URLDecode
函数,但它不起作用。我需要使用简单的字符串替换来删除它还是有更好的方法来做到这一点?
作为 pointed out URLDecode
only works on URL-encoded characters (%26
), not on HTML entities (&
). Use a regular string replacement 将 HTML 实体 &
更改为文字 & 符号:
url = Replace(url, "&", "&")
在 Angular 我添加了 amp;到参数名称
this.activatedRoute.queryParams.subscribe(params => {
this.user_id = params['user_id'];
this.practice_id = params['amp;practice_id'];
this.patient_id = params['amp;patient_id'];
});
我得到一个包含 amp;
的 URL。有没有什么方法可以删除它,因为我目前尝试使用 URLDecode
函数,但它不起作用。我需要使用简单的字符串替换来删除它还是有更好的方法来做到这一点?
作为 URLDecode
only works on URL-encoded characters (%26
), not on HTML entities (&
). Use a regular string replacement 将 HTML 实体 &
更改为文字 & 符号:
url = Replace(url, "&", "&")
在 Angular 我添加了 amp;到参数名称
this.activatedRoute.queryParams.subscribe(params => {
this.user_id = params['user_id'];
this.practice_id = params['amp;practice_id'];
this.patient_id = params['amp;patient_id'];
});