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); |
+} |