diff options
Diffstat (limited to 'mcs/class/corlib/System.Globalization/TextInfo.cs')
-rwxr-xr-x | mcs/class/corlib/System.Globalization/TextInfo.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/mcs/class/corlib/System.Globalization/TextInfo.cs b/mcs/class/corlib/System.Globalization/TextInfo.cs index 7e1d8cc7a1f..43b0da08610 100755 --- a/mcs/class/corlib/System.Globalization/TextInfo.cs +++ b/mcs/class/corlib/System.Globalization/TextInfo.cs @@ -137,11 +137,22 @@ namespace System.Globalization { throw new ArgumentNullException("string is null"); Text.StringBuilder s = new Text.StringBuilder (); - - s.Append (Char.ToUpper (str [0])); - - for (int i = 1; i < str.Length; i ++) - s.Append (str [i]); + bool space_seen = true; + + for (int i = 0; i < str.Length; i ++){ + char c = str [i]; + if (Char.IsLetter (c)){ + if (space_seen) + s.Append (Char.ToUpper (c)); + else + s.Append (Char.ToLower (c)); + space_seen = false; + } else { + s.Append (c); + if (Char.IsWhiteSpace (c)) + space_seen = true; + } + } return s.ToString (); } |