mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-25 15:50:20 +00:00
07b05616a0
Bumps [k8s.io/kubernetes](https://github.com/kubernetes/kubernetes) from 1.26.2 to 1.27.2. - [Release notes](https://github.com/kubernetes/kubernetes/releases) - [Commits](https://github.com/kubernetes/kubernetes/compare/v1.26.2...v1.27.2) --- updated-dependencies: - dependency-name: k8s.io/kubernetes dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
72 lines
2.0 KiB
Go
72 lines
2.0 KiB
Go
// Copyright (c) 2017, A. Stoewer <adrian.stoewer@rz.ifi.lmu.de>
|
|
// All rights reserved.
|
|
|
|
package strcase
|
|
|
|
// isLower checks if a character is lower case. More precisely it evaluates if it is
|
|
// in the range of ASCII character 'a' to 'z'.
|
|
func isLower(ch rune) bool {
|
|
return ch >= 'a' && ch <= 'z'
|
|
}
|
|
|
|
// toLower converts a character in the range of ASCII characters 'A' to 'Z' to its lower
|
|
// case counterpart. Other characters remain the same.
|
|
func toLower(ch rune) rune {
|
|
if ch >= 'A' && ch <= 'Z' {
|
|
return ch + 32
|
|
}
|
|
return ch
|
|
}
|
|
|
|
// isLower checks if a character is upper case. More precisely it evaluates if it is
|
|
// in the range of ASCII characters 'A' to 'Z'.
|
|
func isUpper(ch rune) bool {
|
|
return ch >= 'A' && ch <= 'Z'
|
|
}
|
|
|
|
// toLower converts a character in the range of ASCII characters 'a' to 'z' to its lower
|
|
// case counterpart. Other characters remain the same.
|
|
func toUpper(ch rune) rune {
|
|
if ch >= 'a' && ch <= 'z' {
|
|
return ch - 32
|
|
}
|
|
return ch
|
|
}
|
|
|
|
// isSpace checks if a character is some kind of whitespace.
|
|
func isSpace(ch rune) bool {
|
|
return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'
|
|
}
|
|
|
|
// isDelimiter checks if a character is some kind of whitespace or '_' or '-'.
|
|
func isDelimiter(ch rune) bool {
|
|
return ch == '-' || ch == '_' || isSpace(ch)
|
|
}
|
|
|
|
// iterFunc is a callback that is called fro a specific position in a string. Its arguments are the
|
|
// rune at the respective string position as well as the previous and the next rune. If curr is at the
|
|
// first position of the string prev is zero. If curr is at the end of the string next is zero.
|
|
type iterFunc func(prev, curr, next rune)
|
|
|
|
// stringIter iterates over a string, invoking the callback for every single rune in the string.
|
|
func stringIter(s string, callback iterFunc) {
|
|
var prev rune
|
|
var curr rune
|
|
for _, next := range s {
|
|
if curr == 0 {
|
|
prev = curr
|
|
curr = next
|
|
continue
|
|
}
|
|
|
|
callback(prev, curr, next)
|
|
|
|
prev = curr
|
|
curr = next
|
|
}
|
|
|
|
if len(s) > 0 {
|
|
callback(prev, curr, 0)
|
|
}
|
|
}
|