summaryrefslogtreecommitdiff
path: root/vendor/github.com/felix/go-staticmaps/util.go
blob: 3f5d4ad638644c6440f881cfde5e56e4466da252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2016 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
}