private FormatString [ ] parse ( String s ) { ArrayList < FormatString > al = new ArrayList <> ( ) ; for ( int i = 0 , len = s . length ( ) ; i < len ; ) { int nextPercent = s . indexOf ( ' ' , i ) ; if ( s . charAt ( i ) != ' ' ) { // This is plain-text part, find the maximal plain-text // sequence and store it. int plainTextStart = i ; int plainTextEnd = ( nextPercent == - 1 ) ? len : nextPercent ; al . add ( new FixedString ( s . substring ( plainTextStart , plainTextEnd ) ) ) ; i = plainTextEnd ; } else { // We have a format specifier FormatSpecifierParser fsp = new FormatSpecifierParser ( s , i + 1 ) ; al . add ( fsp . getFormatSpecifier ( ) ) ; i = fsp . getEndIdx ( ) ; } } return al . toArray ( new FormatString [ al . size ( ) ] ) ; }
Finds format specifiers in the format string .