Skip to content

Commit ddd6f7e

Browse files
committed
chore: rm unused extension
1 parent 793a4e0 commit ddd6f7e

1 file changed

Lines changed: 0 additions & 47 deletions

File tree

ObjectSemantics.NET/Engine/Extensions/StringExtensions.cs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,53 +25,6 @@ public static string RemoveLastInstanceOfString(this string value, params char[]
2525
return value;
2626
}
2727

28-
public static string TrimCustom(this string data, char[] chars, int? takeCount)
29-
{
30-
if (string.IsNullOrEmpty(data) || chars == null || chars.Length == 0)
31-
return data;
32-
33-
// If takeCount is null or < 1, behave like normal Trim
34-
if (takeCount == null || takeCount < 1)
35-
return data.Trim(chars);
36-
37-
int leftIndex = 0;
38-
int rightIndex = data.Length - 1;
39-
int leftCount = 0;
40-
int rightCount = 0;
41-
42-
// ⚡ Use simple lookup optimization
43-
// Create a small fixed lookup array for faster char matching
44-
bool[] lookup = new bool[char.MaxValue + 1];
45-
for (int i = 0; i < chars.Length; i++)
46-
lookup[chars[i]] = true;
47-
48-
// Trim from start
49-
while (leftIndex < data.Length && leftCount < takeCount.Value)
50-
{
51-
char c = data[leftIndex];
52-
if (c < lookup.Length && lookup[c])
53-
{
54-
leftIndex++;
55-
leftCount++;
56-
}
57-
else break;
58-
}
59-
60-
// Trim from end
61-
while (rightIndex >= leftIndex && rightCount < takeCount.Value)
62-
{
63-
char c = data[rightIndex];
64-
if (c < lookup.Length && lookup[c])
65-
{
66-
rightIndex--;
67-
rightCount++;
68-
}
69-
else break;
70-
}
71-
72-
return data.Substring(leftIndex, rightIndex - leftIndex + 1);
73-
}
74-
7528
public static string ToMD5String(this string input)
7629
{
7730
try

0 commit comments

Comments
 (0)