Java PrimerMethod Properties in Java

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();
}