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
Add the functions to string processing algorithms proposal and
implement the change.
Move the functions from `String` and `SubString` extensions to
`BidirectionalCollection`. Add tests for `firstMatch`, `wholeMatch`,
and `prefixMatch` that use a custom `BidirectionalCollection` type.
Copy file name to clipboardExpand all lines: Documentation/Evolution/StringProcessingAlgorithms.md
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -162,10 +162,11 @@ We also propose the following regex-powered algorithms as well as their generic
162
162
|`replace(:with:subrange:maxReplacements)`| Replaces all occurrences of the sequence matching the given `RegexComponent` or sequence with a given collection |
163
163
|`split(by:)`| Returns the longest possible subsequences of the collection around elements equal to the given separator |
164
164
|`firstMatch(of:)`| Returns the first match of the specified `RegexComponent` within the collection |
165
+
|`wholeMatch(of:)`| Matches the specified `RegexComponent` in the collection as a whole |
166
+
|`prefixMatch(of:)`| Matches the specified `RegexComponent` against the collection at the beginning |
165
167
|`matches(of:)`| Returns a collection containing all matches of the specified `RegexComponent` |
@@ -609,4 +620,4 @@ Trimming a string from both sides shares a similar story. For example, `"ababa".
609
620
610
621
### Future API
611
622
612
-
Some Python functions are not currently included in this proposal, such as trimming the suffix from a string/collection. This pitch aims to establish a pattern for using `RegexComponent` with string processing algorithms, so that further enhancement can to be introduced to the standard library easily in the future, and eventually close the gap between Swift and other popular scripting languages.
623
+
Some common string processing functions are not currently included in this proposal, such as trimming the suffix from a string/collection, and finding overlapping ranges of matched substrings. This pitch aims to establish a pattern for using `RegexComponent` with string processing algorithms, so that further enhancement can to be introduced to the standard library easily in the future, and eventually close the gap between Swift and other popular scripting languages.
0 commit comments