我想從URL
得到一個值。問題是,它可能有一些特殊字符,我想刪除它。意思是,http://localhost/DoSomething/Index/123#
是我的URL
。我可以得到123#
,現在我想從中刪除#
。如何從jQuery中的URL中刪除特殊字符?
實施例:
URL = http://localhost/DoSomething/Index/123#
結果= 123#
預期結果= 123
var sPageUrl = "http://localhost/DoSomething/Index/123#";
var number = sPageUrl.substring(sPageUrl.lastIndexOf('/') + 1);
alert(number);
我以爲C#也有正則表達式 – user5014677