All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.usc.file.operater.rules.PrefixConvertRule Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
package org.usc.file.operater.rules;

/**
 * 前缀转换
 * 
 * @author ShunLi
 * @notes Created on 2010-12-11
* Revision of last commit:$Revision: 1347 $
* Author of last commit:$Author: [email protected] $
* Date of last commit:$Date: 2011-09-05 23:30:42 +0800 (周一, 05 九月 2011) $
*

*/ public class PrefixConvertRule implements ConvertRule { @Override public String reNameByRule(String oldName) { return reNameByRule(oldName, "", ""); } @Override public String reNameByRule(String oldName, String fix, String newFix) { if (fix == null || fix.trim().length() == 0) { return newFix.concat(oldName); } else { if (oldName.indexOf(fix) != -1 && fix.equals(oldName.substring(0, fix.length()))) { return newFix.concat(oldName.substring(fix.length())); } return oldName; } } @Override public String reNameByRule(String oldName, String fix, String newFix, Boolean isFolder) { int index = oldName.lastIndexOf("\\"); if (index != -1) { return oldName.substring(0, index + 1).concat(reNameByRule(oldName.substring(index + 1), fix, newFix)); } else { return reNameByRule(oldName, fix, newFix); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy