summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Extensions
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-10-01 15:11:21 +0100
committersr55 <[email protected]>2017-10-01 15:11:21 +0100
commitdda2863c2aa895c6650e68cc1f56c6e1522dd91b (patch)
treecc7cf2eacb188714da0dfc7170fc4e122c1c65f3 /win/CS/HandBrakeWPF/Extensions
parent2123622dd5ac13ee4c600e5987d1e081d8ab7c26 (diff)
WinGui; Implement a smarter Title Case Algorithm. This may resolve #922
Diffstat (limited to 'win/CS/HandBrakeWPF/Extensions')
-rw-r--r--win/CS/HandBrakeWPF/Extensions/StringExtensions.cs19
1 files changed, 4 insertions, 15 deletions
diff --git a/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs b/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs
index 35cf4b128..d09c99e20 100644
--- a/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs
+++ b/win/CS/HandBrakeWPF/Extensions/StringExtensions.cs
@@ -9,13 +9,13 @@
namespace HandBrakeWPF.Extensions
{
- using System.Text;
+ using System.Globalization;
/// <summary>
/// String Extensions
/// </summary>
public static class StringExtensions
- {
+ {
/// <summary>
/// Change the input string to title case
/// </summary>
@@ -23,19 +23,8 @@ namespace HandBrakeWPF.Extensions
/// <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();
+ TextInfo textInfo = new CultureInfo(CultureInfo.CurrentCulture.Name, false).TextInfo;
+ return textInfo.ToTitleCase(input);
}
}
}