Sunday Sep 01

Key Concepts

Removing trailing slash

PDFPrintE-mail
Thursday, 26 April 2012 09:44
AddThis Social Bookmark Button

Removing trailing slash in Java

Removing Trailing Slash

NameVersion
 Apache Commons Lang 3.0+

If you are a user of Apache Common Lang you can use the following snippet to remove your trailing slash :

Remove trailing slash using Apache Commons Lang

import org.apache.commons.lang.StringUtils;
import java.io.File;
...
String myHost = "http://www.java-tutorial.ch/"
StringUtils.chomp(myHost,File.separatorChar+"")
...

Tags: import, apache, snippet, slash, trailing, lang, removing, remove, java.io.file;

Add comment


Security code
Refresh

Java Tutorial on Facebook