Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 06f6928

Browse files
committed
Remove ToTitleCase now that it's in .NET Standard 2.0
1 parent 0757bea commit 06f6928

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

src/ServiceStack.Text/PclExport.Net40.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ public override string ReadAllText(string filePath)
6969
return File.ReadAllText(filePath);
7070
}
7171

72-
public override string ToTitleCase(string value)
73-
{
74-
return TextInfo.ToTitleCase(value).Replace("_", String.Empty);
75-
}
76-
7772
public override string ToInvariantUpper(char value)
7873
{
7974
return value.ToString(CultureInfo.InvariantCulture).ToUpper();

src/ServiceStack.Text/PclExport.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ public static void Configure(PclExport instance)
7979

8080
public string PlatformName = "Unknown";
8181

82-
public TextInfo TextInfo = CultureInfo.InvariantCulture.TextInfo;
83-
8482
public RegexOptions RegexOptions = RegexOptions.None;
8583

8684
public StringComparison InvariantComparison = StringComparison.Ordinal;
@@ -93,23 +91,6 @@ public static void Configure(PclExport instance)
9391

9492
public abstract string ReadAllText(string filePath);
9593

96-
public virtual string ToTitleCase(string value)
97-
{
98-
string[] words = value.Split('_');
99-
100-
for (int i = 0; i <= words.Length - 1; i++)
101-
{
102-
if ((!object.ReferenceEquals(words[i], string.Empty)))
103-
{
104-
string firstLetter = words[i].Substring(0, 1);
105-
string rest = words[i].Substring(1);
106-
string result = firstLetter.ToUpper() + rest.ToLower();
107-
words[i] = result;
108-
}
109-
}
110-
return string.Join("", words);
111-
}
112-
11394
// HACK: The only way to detect anonymous types right now.
11495
public virtual bool IsAnonymousType(Type type)
11596
{

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ public static string ToPascalCase(this string value)
748748

749749
public static string ToTitleCase(this string value)
750750
{
751-
return PclExport.Instance.ToTitleCase(value);
751+
return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(value).Replace("_", String.Empty);
752752
}
753753

754754
public static string ToLowercaseUnderscore(this string value)

0 commit comments

Comments
 (0)