Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: pkg/analysis_server/lib/src/services/correction/strings.dart

Issue 562333002: Issue 17024. Quick Fix to find imported library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/correction/strings.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/strings.dart b/pkg/analysis_server/lib/src/services/correction/strings.dart
index ff5c49584d492648e089a36aee3fed70f2c61572..05644382c5311b49924165f6af2eabcc5a4d3742 100644
--- a/pkg/analysis_server/lib/src/services/correction/strings.dart
+++ b/pkg/analysis_server/lib/src/services/correction/strings.dart
@@ -125,3 +125,22 @@ String repeat(String s, int n) {
}
return sb.toString();
}
+
+
+/**
+ * Gets the substring after the last occurrence of a separator.
+ * The separator is not returned.
+ */
+String substringAfterLast(String str, String separator) {
+ if (isEmpty(str)) {
+ return str;
+ }
+ if (isEmpty(separator)) {
+ return '';
+ }
+ int pos = str.lastIndexOf(separator);
+ if (pos == -1) {
+ return str;
+ }
+ return str.substring(pos + separator.length);
+}

Powered by Google App Engine
This is Rietveld 408576698