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

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.