stringfunction.java

来自「一个关于tlms的一个小程序 看看能否帮助到别人」· Java 代码 · 共 54 行

JAVA
54
字号
package com.szmx.tlms.util;

import com.szmx.framework.util.StringUtil;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2006-8-3
 * Time: 14:55:19
 * To change this template use File | Settings | File Templates.
 */
public class StringFunction {
    public StringFunction() {
    }

    public static String AutoString(List strList) {
        int g = 0;
        for (int j = 1; j < strList.size() + 2; j++) {
            for (int i = 0; i < strList.size(); i++) {
                String s = strList.get(i).toString();
                int n = Integer.parseInt(s);
                g = n;
                if (j == n) {
                    break;
                }
            }
            if (j == g) {
                continue;
            }
            String sj = String.valueOf(j);
            String zz = formatString(sj, 6, "0");
            if (zz.equals("999999")) {
                return "000000";
            }
            return formatString(sj, 6, "0");
        }
        return "";
    }

    public static String formatString(String value, int length, String fill) {

        String result = value;
        if (value.length() < length) {
            while (length > value.length()) {
                result = fill + result;
                length = length - 1;
            }
        }
        return result;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?