1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package jdbcadmin.core.util;
21
22 /***
23 * Strings utility
24 */
25 public class StringUtil {
26
27 /*** Default size. */
28 private static final int DEFAULT_SIZE = 4;
29
30 /*** Constructor.*/
31 protected StringUtil() {
32 }
33
34 /***
35 * Adds a String in a buffer.
36 * @param aBuff the buffer
37 * @param aPrefix string to add before the value
38 * @param aSufix string to add after the value
39 * @param aVal value to append
40 * @param aTaille size of the string to append
41 * @param aSep separator
42 * @param aBouchon filler
43 */
44 public static void append(StringBuffer aBuff, String aPrefix, String aSufix, String aVal, int aTaille, String aSep,
45 char aBouchon) {
46 if (aPrefix != null) {
47 aBuff.append(aPrefix);
48 }
49 aBuff.append(aVal);
50 if (aSufix != null) {
51 aBuff.append(aSufix);
52 }
53 int tailleVal = DEFAULT_SIZE;
54 if (aVal != null) {
55 tailleVal = aVal.length();
56 }
57 for (int diff = aTaille - tailleVal; diff > 0; diff--) {
58 aBuff.append(aBouchon);
59 }
60 aBuff.append(aSep);
61 }
62 }