-
We use Go.
And it needs to be unicode friendly. So you can't rely on ASCII alone, and you need to be fine with unicode runes having a concept of upper and lower.
http://play.golang.org/p/1qwU7p3urR
package main import ( "fmt" "strings" ) func main() { fmt.Println(ShoutToWhisper("Hello, playground")) fmt.Println(ShoutToWhisper("HELLO, PLAYGROUND")) } func ShoutToWhisper(s string) string { if strings.ToUpper(s) == s { s = strings.ToLower(s) } return s }
By default Go will do sensible things with Unicode strings, but there is also a
ToUpperSpecial
if the language is known (it's not in our case) as it will disambiguate which runes to consider.
You could activate the code at a percentage, or even at a percentage of a certain piece.
What language are you using for these scripts? Maybe I can hack something neat together.