Here you can find the source of substringAfter(String str, String separator)
public static String substringAfter(String str, String separator)
//package com.java2s; /*/*from ww w . j a va2 s. c om*/ * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { public static String substringAfter(String str, String separator) { if (isEmpty(str)) { return str; } else if (separator == null) { return ""; } else { int pos = str.indexOf(separator); return pos == -1 ? "" : str.substring(pos + separator.length()); } } /** * Check whether the given String is empty. * <p>This method accepts any Object as an argument, comparing it to * {@code null} and the empty String. As a consequence, this method * will never return {@code true} for a non-null non-String object. * <p>The Object signature is useful for general attribute handling code * that commonly deals with Strings but generally has to iterate over * Objects since attributes may e.g. be primitive value objects as well. * * @param str the candidate String * @since 3.2.1 */ public static boolean isEmpty(Object str) { return (str == null || "".equals(str)); } public static boolean equals(String str1, String str2) { return str1 == null ? str2 == null : str1.equals(str2); } }