New StringBuilder class in JDK5.0, DataSource class (operation to DB)

xiaoxiao2021-04-06  305

Starting from JDK 5, the equivalence class for a single thread is added to this class, which is StringBuilder. Compared to this class, you should usually use the StringBuilder class because it supports all the same operations, but because it does not perform synchronization, the speed is faster.

The following method functions

Sprintf0d (SB, 123, 5) -> 00123

Sprintf0d (SB, -123, 5) -> - 0123

/ ** * Before ゼ ゼ 付 加 结果 结果 结果 结果 る る る 列 列 ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ 変 変 ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ文 列 * / public static final stringbuilder sprintf0d (stringbuilder arg, int arg1, int arg2) {long temparg1 = (long) arg1; return arg = Sprintf0d (arg, temparg1, arg2);}

/ ** * Before the ゼ ゼ 付 加 し 结果 结果 结果 结果 结果 る る る 列 ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ ゼ 変 ゼ ゼ ゼ 変 ゼ ゼ ゼ ゼ 変 変文 列 * / public static final stringbuilder sprintf0d (stringbuilder arg, long arg1, int arg2) {boolean flag = false; int Templength; string temp = ""; int J = 0; IF (arg2 <= 0) {Return Arg }} If (arg1 <0) {Flag = true; arg1 = math.abs (arg1); j = 1;}

Temp = String.Valueof (arg1); templength = arg2 - temp.Length () - j; for (int i = 0; i

IF (Flag == True) {TEMP = "-" TEMP;} arg.append (temp);

Return arg;}

///

. StringBuilder / ** * add zeros before the number * @param sb * @param num * @param len * @return * / public static final StringBuilder sprintf0d (StringBuilder sb, long num, int len) {long lng = num; if (LNG <0L) {sb.append ('-'); LNG = -lng; len-;} long k = 10L; for (int I1 = 2; i1

转载请注明原文地址:https://www.9cbs.com/read-132339.html

New Post(0)