stringutility.java
来自「用Swing实现的CHM制作工具」· Java 代码 · 共 35 行
JAVA
35 行
package g2w.app.gchm.lib;
import java.util.Date;
/**
* A utility class to handle string.
*
* @author GreatGhoul
* @version 001 2009-3-21 17:44:59
*/
public class StringUtility {
/**
* Return a string that is length times of cell.
*
* @param cell The cell string.
* @param length The length.
* @return The length times' string
*/
public static String buildString(String cell, int length) {
StringBuilder ret = new StringBuilder(length);
ret.setLength(length);
ret.setCharAt(length - 1, ' ');
return ret.toString().replaceAll(".", cell);
}
public static void main(String[] args) {
System.out.println(StringUtility.buildString("[]", 10000));
}
public static String quote(String text, String quote) {
return quote + text + quote;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?