diff --git a/Sources/LeakDetect/Command.swift b/Sources/LeakDetect/Command.swift index 44e25bb..a0be57d 100644 --- a/Sources/LeakDetect/Command.swift +++ b/Sources/LeakDetect/Command.swift @@ -123,20 +123,3 @@ struct Command: AsyncParsableCommand { } } -extension String { - func removeSuffix(_ text: String) -> String { - if self.hasSuffix(text) { - return String(self.dropLast(text.count)) - } else { - return self - } - } - - func removePrefix(_ text: String) -> String { - if self.hasPrefix(text) { - return String(self.dropFirst(text.count)) - } else { - return self - } - } -} diff --git a/Sources/LeakDetectKit/String+Remove.swift b/Sources/LeakDetectKit/String+Remove.swift new file mode 100644 index 0000000..f56106e --- /dev/null +++ b/Sources/LeakDetectKit/String+Remove.swift @@ -0,0 +1,26 @@ +// +// String+Remove.swift +// +// +// Created by Yume on 2023/8/30. +// + +import Foundation + +public extension String { + func removeSuffix(_ text: String) -> String { + if self.hasSuffix(text) { + return String(self.dropLast(text.count)) + } else { + return self + } + } + + func removePrefix(_ text: String) -> String { + if self.hasPrefix(text) { + return String(self.dropFirst(text.count)) + } else { + return self + } + } +}