public static final String addQuotes ( String szTableNames , char charStart , char charEnd ) { String strFileName = szTableNames ; if ( charStart == - 1 ) charStart = DBConstants . SQL_START_QUOTE ; if ( charEnd == - 1 ) charEnd = DBConstants . SQL_END_QUOTE ; for ( int iIndex = 0 ; iIndex < strFileName . length ( ) ; iIndex ++ ) { if ( ( strFileName . charAt ( iIndex ) == charStart ) || ( strFileName . charAt ( iIndex ) == charEnd ) ) { // If a quote is in this string, replace with a double-quote Fred's -> Fred''s strFileName = strFileName . substring ( 0 , iIndex ) + strFileName . substring ( iIndex , iIndex + 1 ) + strFileName . substring ( iIndex , iIndex + 1 ) + strFileName . substring ( iIndex + 1 , strFileName . length ( ) ) ; iIndex ++ ; // Skip the second quote } } if ( ( charStart != ' ' ) && ( charEnd != ' ' ) ) strFileName = charStart + strFileName + charEnd ; // Spaces in name, quotes required return strFileName ; }
Add these quotes to this string .