[Dive4elements-commits] [PATCH 2 of 3] FíleTools#removeExtension: Moved from PRFParser

Wald Commits scm-commit at wald.intevation.org
Fri Dec 28 13:30:24 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1356697943 -3600
# Node ID b79a3598818c38733edac2d37bc92e6ad3c69833
# Parent  e79ad624f94cbda108f707b029f83c786900bd07
FíleTools#removeExtension: Moved from PRFParser.

diff -r e79ad624f94c -r b79a3598818c artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java	Thu Dec 20 10:55:57 2012 +0100
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java	Fri Dec 28 13:32:23 2012 +0100
@@ -44,6 +44,15 @@
     }
 
 
+    /** Remove everything after dot from name. */
+    public static final String removeExtension(String name) {
+        int index = name.lastIndexOf('.');
+        return index == -1
+            ? name
+            : name.substring(0, index);
+    }
+
+
     public static File getDirectory(String path, String name) {
         if (path == null || name == null) {
             return null;


More information about the Dive4elements-commits mailing list