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

Unified Diff: compiler/java/com/google/dart/compiler/util/StringUtils.java

Issue 8747016: Fix for resolving interface constructors in factory, issue 521. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for error messages. Created 9 years, 1 month 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: compiler/java/com/google/dart/compiler/util/StringUtils.java
diff --git a/compiler/java/com/google/dart/compiler/util/StringUtils.java b/compiler/java/com/google/dart/compiler/util/StringUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..91a1a0f7bf39402364c3c5a2f62eb4f7fb610ff4
--- /dev/null
+++ b/compiler/java/com/google/dart/compiler/util/StringUtils.java
@@ -0,0 +1,36 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.google.dart.compiler.util;
+
+/**
+ * Utilities for {@link String}.
+ */
+public class StringUtils {
+ /**
+ * The empty String <code>""</code>.
+ */
+ public static final String EMPTY = "";
+
+ /**
+ * @return the the substring before the first occurrence of a separator.
+ */
+ public static String substringBefore(String str, String separator) {
+ int index = str.indexOf(separator);
+ if (index == -1) {
+ return str;
+ }
+ return str.substring(0, index);
+ }
+
+ /**
+ * @return the substring after the first occurrence of a separator.
+ */
+ public static String substringAfter(String str, String separator) {
+ int index = str.indexOf(separator);
+ if (index == -1) {
+ return EMPTY;
+ }
+ return str.substring(index + separator.length());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698