public static String parse(String savePath, String filename) {

        Matcher matcher = PARSE_PATTERN.matcher(savePath);
        String matchStr;

        PathFormatKit.currentDate = DateTime.now();

        StringBuffer sb = new StringBuffer();

        while (matcher.find()) {

            matchStr = matcher.group(1);
            if (matchStr.contains("filename")) {
                filename = filename.replace("$", "\\$").replaceAll("[\\/:*?\"<>|]", "");
                matcher.appendReplacement(sb, filename);
            } else {
                matcher.appendReplacement(sb, PathFormatKit.getString(matchStr));
            }

        }

        matcher.appendTail(sb);

        return sb.toString();
    }
public static String parse ( String savePath , String filename ) { Matcher matcher = PARSE_PATTERN . matcher ( savePath ) ; String matchStr ; PathFormatKit . currentDate = DateTime . now ( ) ; StringBuffer sb = new StringBuffer ( ) ; while ( matcher . find ( ) ) { matchStr = matcher . group ( 1 ) ; if ( matchStr . contains ( "filename" ) ) { filename = filename . replace ( "$" , "\\$" ) . replaceAll ( "[\\/:*?\"<>|]" , "" ) ; matcher . appendReplacement ( sb , filename ) ; } else { matcher . appendReplacement ( sb , PathFormatKit . getString ( matchStr ) ) ; } } matcher . appendTail ( sb ) ; return sb . toString ( ) ; }
@param savePath 存储路径
@param filename 文件名
@return 格式化后的存储路径