Skip to content

Commit

Permalink
PR #498: Use string.Trim to trim strings (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
Numpsy authored Aug 6, 2020
1 parent a11665d commit 2082f94
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/ICSharpCode.SharpZipLib/Zip/ZipNameTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,8 @@ public string TransformFile(string name)
name = name.Replace(@"\", "/");
name = WindowsPathUtils.DropPathRoot(name);

// Drop any leading slashes.
while ((name.Length > 0) && (name[0] == '/'))
{
name = name.Remove(0, 1);
}

// Drop any trailing slashes.
while ((name.Length > 0) && (name[name.Length - 1] == '/'))
{
name = name.Remove(name.Length - 1, 1);
}
// Drop any leading and trailing slashes.
name = name.Trim('/');

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

0 comments on commit 2082f94

Please sign in to comment.