Java examples for java.lang:String End
remove Ending Slash
import java.util.Random; public class Main{ public static void main(String[] argv){ String baseUrl = "java2s.com/"; System.out.println(removeEndingSlash(baseUrl)); }// ww w.j a v a 2s. c o m public static String removeEndingSlash(String baseUrl) { if (baseUrl.endsWith("/")) { baseUrl = baseUrl.substring(0, baseUrl.length() - 1); } return baseUrl; } }