private int getSectionLevel ( SpanManager sm , Span sectionNameSpan ) { int begin = sectionNameSpan . getStart ( ) ; int end = sectionNameSpan . getEnd ( ) ; int level = 0 ; try { while ( ( sm . charAt ( begin + level ) == ' ' ) && ( sm . charAt ( end - 1 - level ) == ' ' ) ) { level ++ ; } } catch ( StringIndexOutOfBoundsException e ) { // there is no need to do anything! logger . debug ( "EXCEPTION IS OK: {}" , e . getLocalizedMessage ( ) ) ; } if ( begin + level == end ) { level = ( level - 1 ) / 2 ; } return level ; }
Returns the number of Equality Chars which are used to specify the level of the Section .