public void print ( String value ) { boolean quote = false ; if ( value . length ( ) > 0 ) { char c = value . charAt ( 0 ) ; if ( newLine && ( c < ' ' || ( c > ' ' && c < ' ' ) || ( c > ' ' && c < ' ' ) || ( c > ' ' ) ) ) { quote = true ; } if ( c == ' ' || c == ' ' || c == ' ' ) { quote = true ; } for ( int i = 0 ; i < value . length ( ) ; i ++ ) { c = value . charAt ( i ) ; if ( c == ' ' || c == this . strategy . getDelimiter ( ) || c == ' ' || c == ' ' ) { quote = true ; c = value . charAt ( value . length ( ) - 1 ) ; break ; } } if ( c == ' ' || c == ' ' || c == ' ' ) { quote = true ; } } else if ( newLine ) { // always quote an empty token that is the first // on the line, as it may be the only thing on the // line. If it were not quoted in that case, // an empty line has no tokens. quote = true ; } if ( newLine ) { newLine = false ; } else { out . print ( this . strategy . getDelimiter ( ) ) ; } if ( quote ) { out . print ( escapeAndQuote ( value ) ) ; } else { out . print ( value ) ; } out . flush ( ) ; }
Print the string as the next value on the line . The value will be quoted if needed .