Skip to content

Commit f3699ef

Browse files
committed
Removed unused extension methods.
1 parent bb71ca5 commit f3699ef

File tree

1 file changed

+1
-104
lines changed

1 file changed

+1
-104
lines changed

Source/Shared/Extensions/StringExtensions.cs

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Text.RegularExpressions;
65

76
namespace Exceptionless.Extensions {
87
public static class StringExtensions {
@@ -56,47 +55,14 @@ private static bool CheckForMatch(string pattern, string value, bool ignoreCase
5655

5756
return value.Equals(pattern);
5857
}
59-
60-
public static byte[] ToByteArray(this string hex) {
61-
return Enumerable.Range(0, hex.Length).
62-
Where(x => 0 == x % 2).
63-
Select(x => Convert.ToByte(hex.Substring(x, 2), 16)).
64-
ToArray();
65-
}
66-
58+
6759
public static string ToHex(this IEnumerable<byte> bytes) {
6860
var sb = new StringBuilder();
6961
foreach (byte b in bytes)
7062
sb.Append(b.ToString("x2"));
7163
return sb.ToString();
7264
}
7365

74-
public static bool IsNullOrEmpty(this string item) {
75-
return String.IsNullOrEmpty(item);
76-
}
77-
78-
public static bool IsNullOrWhiteSpace(this string item) {
79-
return String.IsNullOrWhiteSpace(item);
80-
}
81-
82-
public static bool IsMixedCase(this string s) {
83-
if (s.IsNullOrEmpty())
84-
return false;
85-
86-
var containsUpper = false;
87-
var containsLower = false;
88-
89-
foreach (char c in s) {
90-
if (Char.IsUpper(c))
91-
containsUpper = true;
92-
93-
if (Char.IsLower(c))
94-
containsLower = true;
95-
}
96-
97-
return containsLower && containsUpper;
98-
}
99-
10066
public static bool IsValidIdentifier(this string value) {
10167
if (value == null)
10268
return false;
@@ -108,74 +74,5 @@ public static bool IsValidIdentifier(this string value) {
10874

10975
return true;
11076
}
111-
112-
public static string ToPascalCase(this string value, Regex splitRegex) {
113-
if (String.IsNullOrEmpty(value))
114-
return value;
115-
116-
var mixedCase = value.IsMixedCase();
117-
var names = splitRegex.Split(value);
118-
var output = new StringBuilder();
119-
120-
if (names.Length > 1) {
121-
foreach (string name in names) {
122-
if (name.Length > 1) {
123-
output.Append(Char.ToUpper(name[0]));
124-
output.Append(mixedCase ? name.Substring(1) : name.Substring(1).ToLower());
125-
} else {
126-
output.Append(name);
127-
}
128-
}
129-
} else if (value.Length > 1) {
130-
output.Append(Char.ToUpper(value[0]));
131-
output.Append(mixedCase ? value.Substring(1) : value.Substring(1).ToLower());
132-
} else {
133-
output.Append(value.ToUpper());
134-
}
135-
136-
return output.ToString();
137-
}
138-
139-
public static string ToPascalCase(this string value) {
140-
return value.ToPascalCase(_splitNameRegex);
141-
}
142-
143-
/// <summary>
144-
/// Takes a NameIdentifier and spaces it out into words "Name Identifier".
145-
/// </summary>
146-
/// <param name="value">The value to convert.</param>
147-
/// <returns>The string</returns>
148-
public static string[] ToWords(this string value) {
149-
var words = new List<string>();
150-
value = ToPascalCase(value);
151-
152-
MatchCollection wordMatches = _properWordRegex.Matches(value);
153-
foreach (Match word in wordMatches) {
154-
if (!word.Value.IsNullOrWhiteSpace())
155-
words.Add(word.Value);
156-
}
157-
158-
return words.ToArray();
159-
}
160-
161-
/// <summary>
162-
/// Takes a NameIdentifier and spaces it out into words "Name Identifier".
163-
/// </summary>
164-
/// <param name="value">The value to convert.</param>
165-
/// <returns>The string</returns>
166-
public static string ToSpacedWords(this string value) {
167-
string[] words = ToWords(value);
168-
169-
var spacedName = new StringBuilder();
170-
foreach (string word in words) {
171-
spacedName.Append(word);
172-
spacedName.Append(' ');
173-
}
174-
175-
return spacedName.ToString().Trim();
176-
}
177-
178-
private static readonly Regex _properWordRegex = new Regex(@"([A-Z][a-z]*)|([0-9]+)");
179-
private static readonly Regex _splitNameRegex = new Regex(@"[\W_]+");
18077
}
18178
}

0 commit comments

Comments
 (0)