You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swift provides the `BidirectionalCollection` protocol for marking types which support reverse traversal,
49
49
and generic types and algorithms which want to make use of that should add it to their constraints.
50
50
51
+
### >= 0.3.0
52
+
53
+
In `v0.4.0` new methods are added to allow discarding all the elements matching the predicate at the beginning (prefix) or at the ending (suffix) of the collection.
54
+
-`trimmingSuffix(while:)` can only be run on collections conforming to the `BidirectionalCollection` protocol.
55
+
-`trimmingPrefix(while:)` can be run also on collections conforming to the `Collection` protocol.
56
+
57
+
```swift
58
+
let myString =" hello, world "
59
+
print(myString.trimmingPrefix(while: \.isWhitespace)) // "hello, world "
0 commit comments