Documentation ¶
Overview ¶
Package str provides functions for manipulating scientific name-strings.
Index ¶
- Variables
- func CapitalizeName(name string) string
- func FixAllCaps(s string) string
- func IsBoldSurrogate(s string) bool
- func JoinStrings(s1 string, s2 string, sep string) string
- func Normalize(s string) string
- func NormalizePreservingDiaereses(s string) string
- func NumToStr(num string) string
- func ToASCII(s string, m map[rune]string) string
- func TransliterateDiaereses(s string) string
- func Uniq(strs []string) []string
Constants ¶
This section is empty.
Variables ¶
var DiaeresesTransliterations = map[rune]string{'ä': "a", 'ë': "e", 'ï': "i", 'ö': "o", 'ü': "u"}
var GlobalTransliterations = map[rune]string{
'‘': "'", '’': "'", '`': "'", '´': "'",
}
GlobalTransliterations are applied not only to scientific names, but to the whole name-string.
var Transliterations = map[rune]string{
'À': "A", 'Â': "A", 'Ã': "A", 'Á': "A", 'Ç': "C", 'Č': "C", 'Ð': "D",
'Ë': "E", 'É': "E", 'È': "E", 'Í': "I", 'Ì': "I", 'Ï': "I", 'Ł': "L",
'Ň': "N", 'Ñ': "N", 'Ó': "O", 'Ò': "O", 'Ô': "O", 'Õ': "O", 'Ú': "U",
'Ù': "U", 'Ŕ': "R", 'Ř': "R", 'Ŗ': "R", 'Š': "S", 'Ş': "S", 'Ž': "Z",
'à': "a", 'â': "a", 'ã': "a", 'á': "a", 'ç': "c", 'č': "c", 'ë': "e",
'é': "e", 'è': "e", 'ð': "d", 'í': "i", 'ì': "i", 'ï': "i", 'ł': "l",
'ň': "n", 'ñ': "n", 'ó': "o", 'ò': "o", 'ô': "o", 'õ': "o", 'ú': "u",
'ù': "u", 'û': "u", 'ŕ': "r", 'ř': "r", 'ŗ': "r", 'ſ': "s", 'š': "s",
'ş': "s", 'ž': "z", '\'': "", '‘': "", '’': "", '.': "",
'Æ': "Ae", 'Å': "Ao", 'Ä': "Ae", 'Ø': "Oe", 'Ö': "Oe", 'Þ': "Th",
'Ü': "Ue", 'ß': "ss", 'æ': "ae", 'å': "ao", 'ä': "ae", 'ø': "oe",
'ö': "oe", 'þ': "th", 'Œ': "Oe", 'œ': "oe", 'ü': "ue",
}
Transliteration table is used to convert diacritical characters to their latin letter equivalents.
Functions ¶
func CapitalizeName ¶
CapitalizeName function capitalizes the first character of a name-string. It can be a useful option if the data is known to contain 'real' names, for example canonical forms, but they are provided with all letters in lower case.
func FixAllCaps ¶
FixAllCaps converts all-caps authors names to capitalized version.
func IsBoldSurrogate ¶
func JoinStrings ¶
JoinStrings contatenates two strings with a separator. If either of the strings is empty, then the value of another string is returned instead of concatenation.
func Normalize ¶ added in v1.5.4
Normalize takes a string and returns normalized version of it. Normalize function should be indempotent.
func NormalizePreservingDiaereses ¶ added in v1.5.6
NormalizePreservingDiaereses converts diacritics in a UTF8 string to their ASCII equivalents, but preserves diaereses (i.e. ä, ë, ï, ö, ü that occur after a vowel)
func TransliterateDiaereses ¶ added in v1.5.6
Transliterate diaereses (ä, ë, ï, ö, ü) to their ASCII equivalents Note that this is a straight replacement and doesn't check for the existence of a vowel preceding them.
Types ¶
This section is empty.