Skip to content

Commit 0847410

Browse files
committed
Update String+Extension.swift
1 parent 4108edd commit 0847410

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

Sources/Web3Core/Utility/String+Extension.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,6 @@ extension String {
3232
return output
3333
}
3434

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-
5535
public subscript (bounds: CountableClosedRange<Int>) -> String {
5636
let start = index(self.startIndex, offsetBy: bounds.lowerBound)
5737
let end = index(self.startIndex, offsetBy: bounds.upperBound)

0 commit comments

Comments
 (0)