Java PrimerMethod Properties in Java
- By by Dirk Riehle
- April 18, 2000
Listing 12. The "String asString(char, char)" primitive conversion method.
/**
* @methodtype conversion
* @methodproperties primitive
*/
public String asString(char delimiter, char escape) {
if (isEmpty()) {
return "";
}
StringBuffer sb= new StringBuffer();
String delimiterString= String.valueOf(delimiter);
for (int i= 0; i<noComponents(); i++) {
sb.append(basicComponent(i));
sb.append(delimiterString);
}
sb.setLength(sb.length()-1);
return sb.toString();
}