31 lines
394 B
Go
31 lines
394 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func splitTest() {
|
|
|
|
bucketName := "123"
|
|
suffix := ""
|
|
if strings.Contains(bucketName, "/") {
|
|
splitN := strings.SplitN(bucketName, "/", 2)
|
|
bucketName = splitN[0]
|
|
if !strings.HasSuffix(splitN[1], "/") {
|
|
splitN[1] = splitN[1] + "/"
|
|
}
|
|
suffix = splitN[1]
|
|
|
|
}
|
|
|
|
fmt.Println(bucketName)
|
|
fmt.Println(suffix)
|
|
}
|
|
|
|
func main() {
|
|
|
|
splitTest()
|
|
|
|
}
|