Skip to content

Commit 2082f94

Browse files
authored
PR #498: Use string.Trim to trim strings (#498)
1 parent a11665d commit 2082f94

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipNameTransform.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,8 @@ public string TransformFile(string name)
9595
name = name.Replace(@"\", "/");
9696
name = WindowsPathUtils.DropPathRoot(name);
9797

98-
// Drop any leading slashes.
99-
while ((name.Length > 0) && (name[0] == '/'))
100-
{
101-
name = name.Remove(0, 1);
102-
}
103-
104-
// Drop any trailing slashes.
105-
while ((name.Length > 0) && (name[name.Length - 1] == '/'))
106-
{
107-
name = name.Remove(name.Length - 1, 1);
108-
}
98+
// Drop any leading and trailing slashes.
99+
name = name.Trim('/');
109100

110101
// Convert consecutive // characters to /
111102
int index = name.IndexOf("//", StringComparison.Ordinal);

0 commit comments

Comments
 (0)