mirror of
https://github.com/golang/go.git
synced 2025-10-19 11:03:18 +00:00
strconv: use builtin min function in commonPrefixLenIgnoreCase
To make code a bit simpler.
Change-Id: I33b3e04bc810a4838584c477854ef612b355579a
GitHub-Last-Rev: 6d5bbc2a28
GitHub-Pull-Request: golang/go#71927
Reviewed-on: https://go-review.googlesource.com/c/go/+/651975
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
f77bba43aa
commit
bdcd6d1b65
1 changed files with 1 additions and 4 deletions
|
@ -18,10 +18,7 @@ var optimize = true // set to false to force slow-path conversions for testing
|
|||
// prefix of s and prefix, with the character case of s ignored.
|
||||
// The prefix argument must be all lower-case.
|
||||
func commonPrefixLenIgnoreCase(s, prefix string) int {
|
||||
n := len(prefix)
|
||||
if n > len(s) {
|
||||
n = len(s)
|
||||
}
|
||||
n := min(len(prefix), len(s))
|
||||
for i := 0; i < n; i++ {
|
||||
c := s[i]
|
||||
if 'A' <= c && c <= 'Z' {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue