Entfernen Sie Schrägstriche von String JavaScript
str = str.replace(/\\/g, '')
feddynventor
str = str.replace(/\\/g, '')
let path = "/some/string/with-trailing-slash/"
path = path.replace(/\/$/, "") // /some/string/with-a-slash
// * * *
let path = "/some/string/without-a-trailing-slash"
path = path.replace(/\/$/, "") // /some/string/without-a-trailing-slash
string.replace(/\/$/, "")
function someFunction(site)
{
return site.replace(/\/$/, "");
}