File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ import Foundation
1111public extension String {
1212 public var ns : NSString { return ( self as NSString ) }
1313
14- /*public mutating func replace(string: String, replacement: String) {
15- let range = rangeOfString(string)
16- if let range = range {
17- replaceRange(range, with: replacement)
14+ func replaceFirst( _ string: String , replacement: String ) -> String {
15+ if let range = range ( of: string) {
16+ return replacingCharacters ( in: range, with: replacement)
1817 }
19- }*/
18+ return self
19+ }
2020
2121 public func replace( _ string: String , replacement: String ) -> String {
22- let str = self . replacingOccurrences ( of: string, with: replacement)
22+ let str = replacingOccurrences ( of: string, with: replacement)
2323
2424 return str
2525 }
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ public enum SCMCheckoutType {
9090 func branchForPull( ) -> String ? {
9191 switch self {
9292 case . branch( let name) :
93- return name. replace ( " / " , replacement: " " )
93+ return name. replaceFirst ( " / " , replacement: " " )
9494 default :
9595 return nil
9696 }
You can’t perform that action at this time.
0 commit comments