mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-06 17:16:44 +00:00
45 lines
1.3 KiB
Go
45 lines
1.3 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)
|
||
|
}
|