Java String Length Get lengthMinusColors(String thisStr)

Here you can find the source of lengthMinusColors(String thisStr)

Description

length Minus Colors

License

Apache License

Declaration

public static int lengthMinusColors(String thisStr) 

Method Source Code

//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;
    }
}

Related

  1. lengthExpression(final String operand, final long length)
  2. lengthField(String propertyName)
  3. lengthFormat(String str, int maxLength)
  4. lengthIfAllAlpha(String str)
  5. lengthIntegers(String str)
  6. lengthMinusTrailingWhitespace(String line)
  7. lengthOfCommonPrefix(String s1, String s2)
  8. lengthOfStartingWhitespace(String s)
  9. lengthOfString(final String cadena)