Code example for AttributedString

Methods: getIterator

0
	public String getString() {
		return string;
	} 
	 
	public AttributedCharacterIterator getAttributedCharacterIterator() {
		return atrString.getIterator();
	} 
 
	private static String setFormatAndRemoveLabels(String s) {
		underline = -1; // UNDERLINE_OFF
		bold = TextAttribute.WEIGHT_REGULAR;
		italic = TextAttribute.POSTURE_REGULAR;
 
		if (s == null || s.isEmpty()) return s;
 
		// As long as any text format applies the loop continues (any format type is only allowed once) 
		while (true) { 
			if (s.startsWith(FormatLabels.UNDERLINE) && s.endsWith(FormatLabels.UNDERLINE) && (s.length() > 2)) {
				underline = TextAttribute.UNDERLINE_ON;
				s = s.substring(1, s.length() - 1);
			}