01: package org.mmbase.util.functions;
02:
03: import org.mmbase.util.logging.Logger;
04: import org.mmbase.util.logging.Logging;
05:
06: /**
07: * Several utility methods.
08: *
09: * @author Michiel Meeuwissen
10: * @version $Id: Utils.java,v 1.1 2007/06/20 14:14:47 michiel Exp $
11: * @since MMBase-1.9
12: */
13: public final class Utils {
14:
15: private static final Logger log = Logging
16: .getLoggerInstance(Utils.class);
17:
18: public static String getFileItemName(@Name("fileName")
19: String fileName) {
20: if (fileName == null)
21: return null;
22: // some browers provide directory information. Take that away.
23: int pos = fileName.lastIndexOf("\\");
24: if (pos > 0) {
25: fileName = fileName.substring(pos + 1);
26: }
27: pos = fileName.lastIndexOf("/");
28: if (pos > 0) {
29: fileName = fileName.substring(pos + 1);
30: }
31: return fileName;
32:
33: }
34:
35: }
|