MiscUtils.getFileNameWithoutExtension

From: Lachlan Deck (lachlan.dec..mail.com)
Date: Sun Mar 30 2008 - 01:33:23 EDT

  • Next message: Andrew Lindesay: "Debugging with Plugin Development"

    Just perusing things, and noticed this...

    Any reason why this method returns the file using the first index of
    '.' rather than the last? Or why does it not just use
    _resource.getFileExtension?

    package org.objectstyle.wolips.eomodeler.core.utils;

    import org.eclipse.core.resources.IResource;

    public class MiscUtils {
            public static String getFileNameWithoutExtension(IResource _resource) {
                    String fileName = _resource.getName();
                    String fileExtension = _resource.getFileExtension();
                    if (fileExtension != null) {
                            fileName = fileName.substring(0, fileName.indexOf('.'));
                    }
                    return fileName;
            }
    }

    with regards,

    --
    

    Lachlan Deck



    This archive was generated by hypermail 2.0.0 : Sun Mar 30 2008 - 01:34:25 EDT