📄 finalvar.java
字号:
package huitong.util;
public class FinalVar
{
public static String rootPath ="D:\\java\\Tomcat 6.0\\webapps\\photo\\_userRoot\\";
public static int compare(String str1,String str2)
{ //str1 > str2 return 1;
//str1 == str2 return 0;
//str1 < str2 return -1;
//前iShorter个字符相等,如果str1已经结束,返回1;str2结束,返回-1;都结束返回0
int iShorter = str1.length();
int returnValue = 0;
if (str2.length() > iShorter )
{//
iShorter = str2.length();
returnValue = 1;
}
if (str2.length() < iShorter )
{
iShorter = str2.length();
returnValue = -1;
}
int index = 0;
for (;index < iShorter;index++)
{
if (str1.charAt(index) < str2.charAt(index))
{
returnValue = -1;
break;
}
if (str1.charAt(index) > str2.charAt(index)){}
{
returnValue = 1;
break;
}
}
return returnValue;
}
public static String encoding(String str)
{
try
{
str = new String(str.getBytes("iso-8859-1"));
}
catch(Exception e)
{
e.printStackTrace();
}
return str;
}
public static String subFourChars(String str)
{
if (str.length() > 4)
{
str = str.substring(0,4);
}
return str;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -