yattee/Extensions/String+Format.swift

11 lines
287 B
Swift
Raw Normal View History

2021-11-28 14:37:55 +00:00
import Foundation
extension String {
func replacingFirstOccurrence(of target: String, with replacement: String) -> String {
guard let range = range(of: target) else {
return self
}
return replacingCharacters(in: range, with: replacement)
}
}