public static String addFileExtension ( String fileName , VectorGraphicsFormat vectorGraphicsFormat ) { String fileNameWithFileExtension = fileName ; final String newFileExtension = "." + vectorGraphicsFormat . toString ( ) . toLowerCase ( ) ; if ( fileName . length ( ) <= newFileExtension . length ( ) || ! fileName . substring ( fileName . length ( ) - newFileExtension . length ( ) , fileName . length ( ) ) . equalsIgnoreCase ( newFileExtension ) ) { fileNameWithFileExtension = fileName + newFileExtension ; } return fileNameWithFileExtension ; }
Only adds the extension of the VectorGraphicsFormat to the filename if the filename doesn t already have it .