public String formatString(final String strToFormat){
  if (strToFormat != null) {
    if (strToFormat.equalsIgnoreCase(""))     return " ";
    final String valn1=strToFormat.replaceAll("\n"," ");
    final String formtStr=valn1.replaceAll("\r"," ");
    return formtStr.replaceAll("'","''");
  }
 else   return " ";
}

public String formatString ( final String strToFormat ) { if ( strToFormat != null ) { if ( strToFormat . equalsIgnoreCase ( "" ) ) return " " ; final String valn1 = strToFormat . replaceAll ( "\n" , " " ) ; final String formtStr = valn1 . replaceAll ( "\r" , " " ) ; return formtStr . replaceAll ( "'" , "''" ) ; } else return " " ; }
this function is to handle the single quotes .
