1
0
Fork 0
mirror of https://github.com/Luzifer/staticmap.git synced 2024-12-30 09:41:20 +00:00
staticmap/vendor/github.com/Luzifer/go-staticmaps/util.go

19 lines
486 B
Go
Raw Normal View History

// Copyright 2016, 2017 Florian Pigorsch. All rights reserved.
//
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package sm
import (
"strings"
)
// hasPrefix checks if 's' has prefix 'prefix'; returns 'true' and the remainder on success, and 'false', 's' otherwise.
func hasPrefix(s string, prefix string) (bool, string) {
if strings.HasPrefix(s, prefix) {
return true, strings.TrimPrefix(s, prefix)
}
return false, s
}