Android examples for File Input Output:File Path
Returns a copy of the given path with the extension omitted.
// Copyright 2009-2011 Google, All Rights reserved //package com.java2s; public class Main { /**//from w w w . j a v a2 s . co m * Returns a copy of the given path with the extension omitted. * * @param path the path * @return path, with the extension elements omitted. */ public static String trimOffExtension(String path) { int lastSlash = path.lastIndexOf('/'); int lastDot = path.lastIndexOf('.'); return (lastDot > lastSlash) ? path.substring(0, lastDot) : path; } }