Java File Append appendToFileName(File file, String str)

Here you can find the source of appendToFileName(File file, String str)

Description

append To File Name

License

Open Source License

Declaration

public static File appendToFileName(File file, String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static File appendToFileName(File file, String str) {
        String properPath = file.getPath().substring(0, file.getPath().lastIndexOf(File.separator));
        String fileNameWithoutExt = file.getName().substring(0,
                file.getName().lastIndexOf(".") == -1 ? file.getName().length() : file.getName().lastIndexOf("."))
                + str.replaceAll("\\s", "_");
        return new File((properPath + File.separator + fileNameWithoutExt + ".srt"));
    }//w  w w.  j  av a2 s.  c om
}

Related

  1. appendHexJavaScriptRepresentation(StringBuilder sb, char c)
  2. appendTo(String fileName, String str)
  3. appendTo(StringBuffer sb, CharSequence s)
  4. appendToArray(final File[] original, final File[] toAppend)
  5. appendToCollection(final Vector original, final File[] toAppend)
  6. appendToken(StringBuilder path, String token, boolean skipEmpty, boolean skipSeparator)
  7. appendToOutput(InputStream input, OutputStream output)
  8. appendToOutputStream(OutputStream out, String value)