Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String getNameAppendStr(String path, String Str) { int i = path.lastIndexOf("."); if (i == -1 || i == 0) return path + Str; return path.substring(0, i) + Str + path.substring(i, path.length()); } }