File tree Expand file tree Collapse file tree 1 file changed +0
-20
lines changed Expand file tree Collapse file tree 1 file changed +0
-20
lines changed Original file line number Diff line number Diff line change @@ -32,26 +32,6 @@ extension String {
32
32
return output
33
33
}
34
34
35
- /// Splits a string into groups of `every` n characters, grouping from left-to-right by default. If `backwards` is true, right-to-left.
36
- public func split( every: Int , backwards: Bool = false ) -> [ String ] {
37
- var result = [ String] ( )
38
-
39
- for i in stride ( from: 0 , to: self . count, by: every) {
40
- switch backwards {
41
- case true :
42
- let endIndex = self . index ( self . endIndex, offsetBy: - i)
43
- let startIndex = self . index ( endIndex, offsetBy: - every, limitedBy: self . startIndex) ?? self . startIndex
44
- result. insert ( String ( self [ startIndex..< endIndex] ) , at: 0 )
45
- case false :
46
- let startIndex = self . index ( self . startIndex, offsetBy: i)
47
- let endIndex = self . index ( startIndex, offsetBy: every, limitedBy: self . endIndex) ?? self . endIndex
48
- result. append ( String ( self [ startIndex..< endIndex] ) )
49
- }
50
- }
51
-
52
- return result
53
- }
54
-
55
35
public subscript ( bounds: CountableClosedRange < Int > ) -> String {
56
36
let start = index ( self . startIndex, offsetBy: bounds. lowerBound)
57
37
let end = index ( self . startIndex, offsetBy: bounds. upperBound)
You can’t perform that action at this time.
0 commit comments