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
Copy file name to clipboardExpand all lines: Documentation/Evolution/StringProcessingAlgorithms.md
+31-14Lines changed: 31 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,15 @@
4
4
5
5
The standard library is currently missing a large number of `String` algorithms that do exist in Foundation. We introduce a more coherent set of `Collection` algorithms with a focus on string processing, including support for regular expressions.
6
6
7
+
7
8
## Motivation
8
9
9
10
TODO: Motivation for adding both generic `<r: RegexProtocol>` and non-generic algorithm functions.
10
11
11
12
12
13
### Use custom parsers in regex builders and `RegexProtocol` algorithms
13
14
14
-
It would be handy if you can use types from outside the standard libraryin regex builders and `RegexProtocol` algorithms.
15
+
We want to extend string processing to types from outside the standard library, so that one can incorporate custom parsers in regex builders and `RegexProtocol` algorithms seamlessly.
15
16
16
17
Consider parsing an HTTP header to capture the date field as a `Date` type:
17
18
@@ -105,17 +106,21 @@ The following algorithms are included in this pitch:
105
106
106
107
```swift
107
108
extensionCollectionwhereElement:Equatable {
108
-
/// Returns a Boolean value indicating whether the collection contains the given sequence.
109
+
/// Returns a Boolean value indicating whether the collection contains the
110
+
/// given sequence.
109
111
/// - Parameter other: A sequence to search for within this collection.
110
-
/// - Returns: `true` if the collection contains the specified sequence, otherwise `false`.
112
+
/// - Returns: `true` if the collection contains the specified sequence,
/// Returns a new collection of the same type by removing initial elements that satisfy the given predicate from the start
139
-
/// - Parameter predicate: A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element should be removed from the collection.
140
-
/// - Returns: A collection containing the elements of the receiver that are not removed by `predicate`.
145
+
/// Returns a new collection of the same type by removing initial elements
146
+
/// that satisfy the given predicate from the start
147
+
/// - Parameter predicate: A closure that takes an element of the sequence
148
+
/// as its argument and returns a Boolean value indicating whether the
149
+
/// element should be removed from the collection.
150
+
/// - Returns: A collection containing the elements of the receiver that are
/// Removes the initial elements that satisfy the given predicate from the start of the sequence.
146
-
/// - Parameter predicate: A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element should be removed from the collection.
156
+
/// Removes the initial elements that satisfy the given predicate from the
157
+
/// start of the sequence.
158
+
/// - Parameter predicate: A closure that takes an element of the sequence
159
+
/// as its argument and returns a Boolean value indicating whether the
160
+
/// element should be removed from the collection.
/// Removes the initial elements that satisfy the given predicate from the start of the sequence.
152
-
/// - Parameter predicate: A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element should be removed from the collection.
165
+
/// Removes the initial elements that satisfy the given predicate from the
166
+
/// start of the sequence.
167
+
/// - Parameter predicate: A closure that takes an element of the sequence
168
+
/// as its argument and returns a Boolean value indicating whether the
169
+
/// element should be removed from the collection.
0 commit comments