1 28 29 package org.objectweb.util.misc.lib; 30 31 37 public abstract class StringBufferHelper 38 { 39 45 51 57 63 69 public static void append(StringBuffer sb, String string) { 70 sb.append('\"'); 71 sb.append(string); 72 sb.append('\"'); 73 } 74 75 81 public static void append(StringBuffer sb, String [] strings) { 82 sb.append('{'); 83 if(strings.length > 0) { 84 append(sb, strings[0]); 85 for(int i=1; i<strings.length; i++) { 86 sb.append(','); 87 append(sb, strings[i]); 88 } 89 } 90 sb.append('}'); 91 } 92 93 100 public static void append(StringBuffer sb, String name, boolean value) { 101 sb.append(name); 102 sb.append('='); 103 sb.append(value); 104 sb.append(','); 105 } 106 107 114 public static void append(StringBuffer sb, String name, int value) { 115 sb.append(name); 116 sb.append('='); 117 sb.append(value); 118 sb.append(','); 119 } 120 121 128 public static void append(StringBuffer sb, String name, String value) { 129 sb.append(name); 130 sb.append('='); 131 append(sb, value); 132 sb.append(','); 133 } 134 135 142 public static void append(StringBuffer sb, String name, String [] value) { 143 sb.append(name); 144 sb.append('='); 145 append(sb, value); 146 sb.append(','); 147 } 148 149 157 public static void append(StringBuffer sb, String [] strings, String separator) { 158 if(strings.length > 0) { 159 sb.append(strings[0]); 160 for(int i=1; i<strings.length; i++) { 161 sb.append(separator); 162 sb.append(strings[i]); 163 } 164 } 165 } 166 167 } 173 | Popular Tags |