-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add optional starting position to String.replaceFirst. #3194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We still have nothing like String.replaceLast, which I keep needing. Otherwise, the starting position for replaceFirst would be great. And a starting position for RegExp.firstMatch. |
Added Library-Core label. |
I don't think we will add String.replaceLast. It depends on searching backwards, and Pattern doesn't have that functionality (and we are not likely to add it). That means that the special casing for searching backwards for a string has to be in String.replaceLast, and other patterns can't get the same special treatment. That's undesirable. |
The start-index on replaceFirst has been added (thanks srawlins). Added Fixed label. |
Changes: ``` > git log --format="%C(auto) %h %s" 78bc50c..0035a40 https://dart.googlesource.com/pub.git/+/0035a40f Fix echo mode crash on `token add` (#3194) https://dart.googlesource.com/pub.git/+/a75a8c17 Don't warn against discontinued transitive dependencies (#3195) https://dart.googlesource.com/pub.git/+/cf2ed105 Fix analytics code (#3197) https://dart.googlesource.com/pub.git/+/08e13f7b Remove unused golden files (#3189) https://dart.googlesource.com/pub.git/+/b6293b80 Fix log message related to `pub global activate` (#3187) https://dart.googlesource.com/pub.git/+/94f6b477 Introducing command-line interface tests (#3161) https://dart.googlesource.com/pub.git/+/3ba8134f More details from getExecutableForCommand (#3186) https://dart.googlesource.com/pub.git/+/a2dbcfff Shorthand syntax for hosted dependencies (#3133) https://dart.googlesource.com/pub.git/+/435e4e3f Shuffle analytics (#3185) ``` Diff: https://dart.googlesource.com/pub.git/+/78bc50c7833451c24e531713362e46fd50621ff0~..0035a40f25d027130c0314571da53ffafc6d973b/ Change-Id: Idfd7c382985d1ad3e3ad87a621dc79d3b74e898e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218620 Reviewed-by: Jonas Jensen <[email protected]> Commit-Queue: Sigurd Meldgaard <[email protected]>
…1 revision) https://dart.googlesource.com/dartdoc/+log/ce5bd271eda9..691fa9640aae 2022-09-27 [email protected] Make two regular expressions static (#3194) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/dart-doc-dart-sdk Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: [email protected] Change-Id: I3c6ed921c2919d5fc224ed1ebd05710dcfaf49f0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261462 Commit-Queue: DEPS Autoroller <[email protected]> Commit-Queue: Nate Bosch <[email protected]> Reviewed-by: Nate Bosch <[email protected]>
Just as String.contains allows one to start a search at the middle of a string, it would be nice if we could replace starting at a certain offset.
This slightly simplifies "Replace the last _ in a string with /".
Of course, working RegExp in replace would also allow this.
Also, should RegExp.matchFirst allow starting at an index in the string?
The text was updated successfully, but these errors were encountered: