We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb32ed3 commit f1358d0Copy full SHA for f1358d0
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
@@ -1096,14 +1096,10 @@ private void ThrowIfInvalidArchive()
1096
/// </summary>
1097
private static string GetFileName_Windows(string path)
1098
{
1099
- int length = path.Length;
1100
- for (int i = length; --i >= 0;)
1101
- {
1102
- char ch = path[i];
1103
- if (ch == '\\' || ch == '/' || ch == ':')
1104
- return path.Substring(i + 1);
1105
- }
1106
- return path;
+ int i = path.AsSpan().LastIndexOfAny('\\', '/', ':');
+ return i >= 0 ?
+ path.Substring(i + 1) :
+ path;
1107
}
1108
1109
/// <summary>
0 commit comments