
org.fife.tmm.Utils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tokenmakermaker Show documentation
Show all versions of tokenmakermaker Show documentation
An application to easily create syntax highlighting for custom languages in RSyntaxTextArea.
The newest version!
package org.fife.tmm;
import java.io.File;
/**
* Obligatory utility methods.
*
* @author Robert Futrell
* @version 1.0
*/
final class Utils {
private Utils() {
}
/**
* Returns a file with a different extension.
*
* @param file A file.
* @param newExtension The new extension.
* @return A file with its extension replaced by the new one.
*/
static File getFileWithNewExtension(File file, String newExtension) {
String path = file.getAbsolutePath();
int lastDot = path.lastIndexOf('.');
if (lastDot>-1) {
path = path.substring(0, lastDot+1) + newExtension;
}
else {
path = path + "." + newExtension;
}
return new File(path);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy