Function: csv--unquote-value

csv--unquote-value is a natively compiled function defined in csv-mode.el.

Signature

(csv--unquote-value VALUE)

Documentation

Remove quotes around VALUE.

If VALUE contains escaped quote characters, un-escape them. If VALUE is not quoted, return it unchanged.

Source Code

;; Defined in /nix/store/3gmjnyw9n226b7k7jamikx980vf8267p-emacs-packages-deps/share/emacs/site-lisp/elpa/csv-mode-1.27/csv-mode.el
(defun csv--unquote-value (value)
  "Remove quotes around VALUE.
If VALUE contains escaped quote characters, un-escape them.  If
VALUE is not quoted, return it unchanged."
  (save-match-data
    (let ((quote-regexp (apply #'concat `("[" ,@csv-field-quotes "]"))))
      (if-let (((string-match (concat "^\\(" quote-regexp "\\)\\(.*\\)\\(" quote-regexp "\\)$") value))
               (quote-char (match-string 1 value))
               ((equal quote-char (match-string 3 value)))
               (unquoted (match-string 2 value)))
          (replace-regexp-in-string (concat quote-char quote-char) quote-char unquoted)
        value))))