Here you can find the source of substringAfter(String text, char c)
Parameter | Description |
---|---|
text | a parameter |
separator | a parameter |
public static String substringAfter(String text, char c)
//package com.java2s; public class Main { /**/* w ww. j a v a 2s .c o m*/ * Gives the substring of the given text after the given separator. * * If the text does not contain the given separator then "" is returned. * * @param text * @param separator * @return */ public static String substringAfter(String text, char c) { if (isEmpty(text)) { return text; } int cPos = text.indexOf(c); if (cPos < 0) { return ""; } return text.substring(cPos + 1); } /** * Whether the given string is null or zero-length. * * @param text * @return */ public static boolean isEmpty(String text) { return (text == null) || (text.length() == 0); } }