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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 package com.google.dart.compiler.util;
5
6 /**
7 * Utilities for {@link String}.
8 */
9 public class StringUtils {
10 /**
11 * The empty String <code>""</code>.
12 */
13 public static final String EMPTY = "";
14
15 /**
16 * @return the the substring before the first occurrence of a separator.
17 */
18 public static String substringBefore(String str, String separator) {
19 int index = str.indexOf(separator);
20 if (index == -1) {
21 return str;
22 }
23 return str.substring(0, index);
24 }
25
26 /**
27 * @return the substring after the first occurrence of a separator.
28 */
29 public static String substringAfter(String str, String separator) {
30 int index = str.indexOf(separator);
31 if (index == -1) {
32 return EMPTY;
33 }
34 return str.substring(index + separator.length());
35 }
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698