Skip to content

Commit

Permalink
Merge pull request JohnSundell#18 from JohnSundell/extension-end-index
Browse files Browse the repository at this point in the history
FileSystemItem: Simplify nameExcludingExtension calculation
  • Loading branch information
JohnSundell authored Jun 11, 2017
2 parents e5e3baa + a97ab87 commit 948f4b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ public class FileSystem {
guard let `extension` = `extension` else {
return name
}
let startIndex = name.index(name.endIndex, offsetBy: -`extension`.characters.count - 1)
return name.replacingCharacters(in: startIndex..<name.endIndex, with: "")

let endIndex = name.index(name.endIndex, offsetBy: -`extension`.characters.count - 1)
return name.substring(to: endIndex)
}

/// Any extension that the item has
Expand Down

0 comments on commit 948f4b5

Please sign in to comment.