Java examples for java.lang:String Substring
get After Separator Or All
//package com.java2s; public class Main { public static void main(String[] argv) { String name = "java2s.com"; System.out.println(getAfterSeparatorOrAll(name)); }/*from www . ja v a 2 s . c om*/ private static final String SEPARATOR = ":"; public static String getAfterSeparatorOrAll(String name) { int index = name.indexOf(SEPARATOR); if (index == -1) return name; else return name.substring(index + 1); } }