private int checkZoneLink(SpannableStringBuilder out,String in,int start){
  int pos=start + 3;
  StringBuilder temp=new StringBuilder();
  String targetString=in.substring(pos,Math.min(in.length(),pos + 20));
  boolean prevIsDash=false;
  for (int i=0; i < targetString.length(); i++) {
    char c=targetString.charAt(i);
    if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) {
      temp.append(c);
      prevIsDash=false;
    }
 else     if (c == '-') {
      if (i == 0) {
        return -1;
      }
      if (prevIsDash) {
        temp.deleteCharAt(temp.length() - 1);
        break;
      }
      temp.append(c);
      prevIsDash=true;
    }
 else {
      if (prevIsDash) {
        temp.deleteCharAt(temp.length() - 1);
      }
      break;
    }
  }
  String zone=temp.toString();
  if (zone.length() < 3 || zone.equalsIgnoreCase("null")) {
    return -1;
  }
  out.append(zone);
  return pos + zone.length() - 1;
}

private int checkZoneLink ( SpannableStringBuilder out , String in , int start ) { int pos = start + 3 ; StringBuilder temp = new StringBuilder ( ) ; String targetString = in . substring ( pos , Math . min ( in . length ( ) , pos + 20 ) ) ; boolean prevIsDash = false ; for ( int i = 0 ; i < targetString . length ( ) ; i ++ ) { char c = targetString . charAt ( i ) ; if ( ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) ) { temp . append ( c ) ; prevIsDash = false ; } else if ( c == '-' ) { if ( i == 0 ) { return - 1 ; } if ( prevIsDash ) { temp . deleteCharAt ( temp . length ( ) - 1 ) ; break ; } temp . append ( c ) ; prevIsDash = true ; } else { if ( prevIsDash ) { temp . deleteCharAt ( temp . length ( ) - 1 ) ; } break ; } } String zone = temp . toString ( ) ; if ( zone . length ( ) < 3 || zone . equalsIgnoreCase ( "null" ) ) { return - 1 ; } out . append ( zone ) ; return pos + zone . length ( ) - 1 ; }
change this should review zone . java
