From 0c4cf8857849aa4b81b0d0b2f72becacc36e5535 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 26 Nov 2008 21:11:44 +0000 Subject: [PATCH] perl-like strip --- Ledger/Utils.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Ledger/Utils.hs b/Ledger/Utils.hs index b74ee737f..8f09a6723 100644 --- a/Ledger/Utils.hs +++ b/Ledger/Utils.hs @@ -42,6 +42,9 @@ import Text.ParserCombinators.Parsec -- strings +strip = dropspaces . reverse . dropspaces . reverse + where dropspaces = dropWhile (`elem` " \t") + elideLeft width s = case length s > width of True -> ".." ++ (reverse $ take (width - 2) $ reverse s)