Here you can find the source of lengthMinusColors(String thisStr)
public static int lengthMinusColors(String thisStr)
//package com.java2s; //License from project: Apache License public class Main { public static int lengthMinusColors(String thisStr) { int size = 0; for (int i = 0; i < thisStr.length(); i++) { if (thisStr.charAt(i) == '^') { i++;//www . j av a2 s . c om if ((i + 1) < thisStr.length()) { final int tagStart = i; final char c = thisStr.charAt(i); if ((c == '<') || (c == '&')) while (i < (thisStr.length() - 1)) { if (((c == '<') && ((thisStr.charAt(i) != '^') || (thisStr.charAt(i + 1) != '>'))) || ((c == '&') && (thisStr.charAt(i) != ';'))) { i++; if (i >= (thisStr.length() - 1)) { i = tagStart + 1; break; } } else { i++; break; } } } } else size++; } return size; } }