Here you can find the source of substringAfter(String str, int beginChar, boolean last)
public static String substringAfter(String str, int beginChar, boolean last)
//package com.java2s; /*!/* ww w .j a va 2s . c om*/ * mifmi-commons4j * https://github.com/mifmi/mifmi-commons4j * * Copyright (c) 2015 mifmi.org and other contributors * Released under the MIT license * https://opensource.org/licenses/MIT */ public class Main { public static String substringAfter(String str, int beginChar, boolean last) { if (str == null) { return null; } if (beginChar < 0) { return str; } int idx = (last) ? str.lastIndexOf(beginChar) : str.indexOf(beginChar); if (idx == -1) { return str; } return str.substring(idx); } public static String substringAfter(String str, String beginStr, boolean last) { if (str == null) { return null; } if (beginStr == null) { return str; } int idx = (last) ? str.lastIndexOf(beginStr) : str.indexOf(beginStr); if (idx == -1) { return str; } return str.substring(idx); } public static int lastIndexOf(CharSequence charSeq, char ch) { if (charSeq == null) { return -1; } return lastIndexOf(charSeq, ch, charSeq.length() - 1); } public static int lastIndexOf(CharSequence charSeq, char ch, int fromIndex) { if (charSeq == null) { return -1; } for (int i = fromIndex; 0 <= i; i--) { char c = charSeq.charAt(i); if (c == ch) { return i; } } return -1; } public static int lastIndexOf(CharSequence charSeq, char[] ch) { if (charSeq == null) { return -1; } return lastIndexOf(charSeq, ch, charSeq.length() - 1); } public static int lastIndexOf(CharSequence charSeq, char ch[], int fromIndex) { if (charSeq == null) { return -1; } for (int i = fromIndex; 0 <= i; i--) { char c = charSeq.charAt(i); for (int j = 0; j < ch.length; j++) { if (c == ch[j]) { return i; } } } return -1; } public static int indexOf(CharSequence charSeq, char ch) { return indexOf(charSeq, ch, 0); } public static int indexOf(CharSequence charSeq, char ch, int fromIndex) { if (charSeq == null) { return -1; } int len = charSeq.length(); for (int i = fromIndex; i < len; i++) { char c = charSeq.charAt(i); if (c == ch) { return i; } } return -1; } public static int indexOf(CharSequence charSeq, char[] ch) { return indexOf(charSeq, ch, 0); } public static int indexOf(CharSequence charSeq, char[] ch, int fromIndex) { if (charSeq == null) { return -1; } int len = charSeq.length(); for (int i = fromIndex; i < len; i++) { char c = charSeq.charAt(i); for (int j = 0; j < ch.length; j++) { if (c == ch[j]) { return i; } } } return -1; } }