📄 filenamedeal.java
字号:
package cn.dxm.util;
import java.util.ArrayList;
public class FileNameDeal {
private String endWith;
public FileNameDeal() {
}
public FileNameDeal(String endWith) {
this.endWith = endWith;
}
public String getFileNameEnds() {
String result = null;
int beginIndex = endWith.lastIndexOf('.') + 1;
int endIndex = endWith.length();
result = endWith.substring(beginIndex, endIndex);
return result;
}
// 叛断一个文件是否为一张图片.根据后缀来叛.
public boolean wetherIsIMG(String end) {
if (end.equals("jpg") || end.equals("JPG") || end.equals("GIF") || end.equals("JPEG") || end.equals("jpeg")
|| end.equals("gif") || end.equals("PNG") || end.equals("png")||end.equals("bmp")||end.equals("BMP"))
return true;
else
return false;
}
public int locationIMG(ArrayList list, String imageName) {
int result = 0;
result = list.indexOf(imageName);
return result;
}
// 如果文件名有扣缀,前为图片后缀,即为.jpg,.png,.gif则,返回true.否则返回false;
public static boolean whetherAImageName(String imageName) {
if (imageName.endsWith(".jpg") || imageName.endsWith(".JPG")
|| imageName.endsWith(".gif") || imageName.endsWith(".GIF")
|| imageName.endsWith(".png") || imageName.endsWith(".PNG")
)
return true;
else return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -