summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-03-27 20:08:33 +0000
committersr55 <[email protected]>2011-03-27 20:08:33 +0000
commitabd251048b392e86041325c1561e7a9dcd8067c3 (patch)
tree6f18df3389db6994e5f454e423880f73c7a5e8d6 /win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs
parent5b0977cc04f8d6471905f4090c7f18e6240988da (diff)
WinGui:
- Some move re factoring to push the logic code into the service library. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3885 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs b/win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs
new file mode 100644
index 000000000..42f40c13b
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Extensions/StringExtensions.cs
@@ -0,0 +1,34 @@
+/* StringExtensions.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Extensions
+{
+ using System.Text;
+
+ public static class StringExtensions
+ {
+ /// <summary>
+ /// Change the input string to title case
+ /// </summary>
+ /// <param name="input">the input string</param>
+ /// <returns>the input string in title case</returns>
+ 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();
+ }
+ }
+}