标签:
之所以补空格因为 该长度不一的时候 有时候会导致 ORACLE数据库的子SQL 变得很多多. 导致非常慢.
ORACLE 11G 11.2.01 打补丁风险太大
只好补空格让其一直. 注意采用的字节长度
public static String formatStr(String str, int length)
{
if (str == null)
{
str="";
}
int strLen = str.getBytes().length;
if (strLen == length)
{
return str;
} else if (strLen < length)
{
int temp = length - strLen;
String tem = "";
for (int i = 0; i < temp; i++)
{
tem = tem + " ";
}
return str + tem;
} else
{
return str.substring(0, length);
}
}标签:
原文地址:http://blog.csdn.net/zengmuansha/article/details/46047517