Java examples for java.lang:String Substring
get After Separator Or Nothing
//package com.java2s; public class Main { public static void main(String[] argv) { String name = "java2s.com"; System.out.println(getAfterSeparatorOrNothing(name)); }/*ww w .j a v a2 s . co m*/ private static final String SEPARATOR = ":"; public static String getAfterSeparatorOrNothing(String name) { int index = name.indexOf(SEPARATOR); if (index == -1) return ""; else return name.substring(index + 1); } }