Function: haskell-string-trim

haskell-string-trim is a natively compiled function defined in haskell-string.el.

Signature

(haskell-string-trim STRING)

Documentation

Remove whitespace around STRING.

A Whitespace character is defined in the Haskell Report as follows

  whitechar -> newline | vertab | space | tab | uniWhite
  newline -> return linefeed | return | linefeed | formfeed
  uniWhite -> any Unicode character defined as whitespace

Note: The implementation currently only supports ASCII
      white-space characters, i.e. the implementation doesn't
      consider uniWhite.

Source Code

;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-string.el
(defun haskell-string-trim (string)
  "Remove whitespace around STRING.

A Whitespace character is defined in the Haskell Report as follows

  whitechar -> newline | vertab | space | tab | uniWhite
  newline   -> return linefeed | return | linefeed | formfeed
  uniWhite  -> any Unicode character defined as whitespace

Note: The implementation currently only supports ASCII
      white-space characters, i.e. the implementation doesn't
      consider uniWhite."

  (let ((s1 (if (string-match "[\t\n\v\f\r ]+\\'" string) (replace-match "" t t string) string)))
    (if (string-match "\\`[\t\n\v\f\r ]+" s1) (replace-match "" t t s1) s1)))