create or replace and compile java source named Pxkczz as
import java.util.Arrays;
import java.util.Collections;
public class Pxkczz {
public static String pxkkzz(String str)
{
if (str==null||"".equals(str))
{
return "";
}
StringBuffer stringBuffer = new StringBuffer();
StringBuffer stringBuffer1 = new StringBuffer();
String[] strlist = str.split(",");
for (int i = 0; i < strlist.length; i++)
{
if (strlist[i]==null||"".equals(strlist[i])) {
continue;
}
stringBuffer1.append(strlist[i]);
stringBuffer1.append(",");
}
if (strlist.length==0) {
return "";
}
String[] strlist1 = (String[]) (stringBuffer1==null?"":stringBuffer1.toString().split(","));
int[] array = new int[strlist1.length];
for(int i=0;i<strlist1.length;i++){
if (strlist1[i]==null||"".equals(strlist1[i])) {
continue;
}
array[i]=Integer.parseInt(strlist1[i]);
}
Arrays.sort(array);
for (int i = 0; i < array.length; i++)
{
stringBuffer.append(array[i]);
stringBuffer.append(",");
}
if (stringBuffer.toString().endsWith(","))
{
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
}
return stringBuffer.toString();
}
};
Oracle创建java排序实现“,”分隔的数字字符串排序(由小到大)
最新推荐文章于 2023-02-10 15:35:48 发布