slash method improved

This commit is contained in:
alessio 2016-08-21 13:29:42 +02:00
parent b26146a05e
commit 1f0be18f23
1 changed files with 3 additions and 1 deletions

View File

@ -193,7 +193,9 @@ func slash(str string) string {
str = "/" + str str = "/" + str
} }
if string(str[len(str)-1]) == "/" { if string(str[len(str)-1]) == "/" {
if string(str) == "/" { if len(str) == 0 {
return str
} else if string(str) == "/" {
str = "" str = ""
} else { } else {
str = str[0 : len(str)-2] str = str[0 : len(str)-2]