Retours sur la structure du code

This commit is contained in:
2023-12-08 17:37:21 +01:00
committed by Loris Perret
parent 5427ff6786
commit dfe31b5c80
13 changed files with 177 additions and 143 deletions

View File

@ -63,7 +63,7 @@ public extension String {
replacingOccurrences(of: "~", with: "\(FileManager.default.homeDirectoryForCurrentUser.relativePath)")
}
func colorComponent() -> (alpha: String, red: String, green: String, blue: String) {
func colorComponent() -> (alpha: String, red: String, green: String, blue: String) {
var alpha: String = "FF"
var red: String
var green: String
@ -89,4 +89,19 @@ public extension String {
func uppercasedFirst() -> String {
prefix(1).uppercased() + dropFirst()
}
func replacingFirstOccurrence(of: String, with: String) -> Self {
if let range = self.range(of: of) {
let tmp = self.replacingOccurrences(
of: of,
with: with,
options: .literal,
range: range
)
return tmp
}
return self
}
}