Java String Sanitize sanitizeForCsv(String str)

Here you can find the source of sanitizeForCsv(String str)

Description

Sanitizes the string for comma-separated values (CSV) file output.<br> We follow the definition described by RFC 4180:<br> http://tools.ietf.org/html/rfc4180

License

Open Source License

Declaration

public static String sanitizeForCsv(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  w w  w .j av a 2  s .co m*/
     * Sanitizes the string for comma-separated values (CSV) file output.<br>
     * We follow the definition described by RFC 4180:<br>
     * {@link http://tools.ietf.org/html/rfc4180}
     */
    public static String sanitizeForCsv(String str) {
        return "\"" + str.replace("\"", "\"\"") + "\"";
    }
}

Related

  1. sanitizeCompletion(String replace)
  2. sanitizeDescription(String description)
  3. sanitizeDir(String name)
  4. sanitizeFolderName(String s)
  5. sanitizeForCmisName(String in)
  6. sanitizeForJson(String data)
  7. sanitizeForLogMessage(String unsanitizedString)
  8. sanitizeForSearch(String str)
  9. sanitizeForSemgrexName(String text)