Tag: 尾随斜线

返回没有结尾的string

我有两个variables: site1 = "www.somesite.com"; site2 = "www.somesite.com/"; 我想要做这样的事情 function someFunction(site) { // If the var has a trailing slash (like site2), // remove it and return the site without the trailing slash return no_trailing_slash_url; } 我该怎么做呢?