/* StringExtensions.cs $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ namespace HandBrake.ApplicationServices.Extensions { using System.Text; public static class StringExtensions { /// /// Change the input string to title case /// /// the input string /// the input string in title case public static string ToTitleCase(this string input) { string[] tokens = input.Split(' '); StringBuilder sb = new StringBuilder(input.Length); foreach (string s in tokens) { if (!string.IsNullOrEmpty(s)) { sb.Append(s[0].ToString().ToUpper()); sb.Append(s.Substring(1).ToLower()); sb.Append(" "); } } return sb.ToString().Trim(); } } }