Strip whitespace from a string/Top and tail: Difference between revisions

Replaced recursion with expensive 'all' guard for a cleaner and better performing dropWhileEnd
(→‎{{header|OCaml}}: String.trim since ocaml 4.00.0)
(Replaced recursion with expensive 'all' guard for a cleaner and better performing dropWhileEnd)
Line 949:
 
=={{header|Haskell}}==
<lang haskell>import Data.Char (isSpace)
import Data.List (dropWhileEnd)
 
trimLeft :: String -> String
Line 955 ⟶ 956:
 
trimRight :: String -> String
trimRight str= | alldropWhileEnd isSpace str = ""
trimRight (c : cs) = c : trimRight cs
 
trim :: String -> String