changeset 452:b79a3598818c

FĂ­leTools#removeExtension: Moved from PRFParser.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 28 Dec 2012 13:32:23 +0100
parents e79ad624f94c
children a2efc9d65a11
files artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;

http://dive4elements.wald.intevation.org