From f0ed4df2b0e11ab66966a8395cd7d6d29c7a8efc Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Fri, 3 Jul 2015 23:39:40 +0200 Subject: Latex & Html output options --- StringUtils.icl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'StringUtils.icl') diff --git a/StringUtils.icl b/StringUtils.icl index 811b3d2..91e3d4f 100644 --- a/StringUtils.icl +++ b/StringUtils.icl @@ -31,15 +31,17 @@ where s` :: [Char] s` = fromString s -pad_right :: Char String Int -> String +pad_right :: String String Int -> String pad_right c s l | strlen s >= l = s -| otherwise = s +++ toString (repeatn (l - strlen s) c) +| strlen c == 0 = s +| otherwise = foldl (+++) s (repeatn ((l - strlen s) / strlen c) c) -pad_left :: Char String Int -> String +pad_left :: String String Int -> String pad_left c s l | strlen s >= l = s -| otherwise = toString (repeatn (l - strlen s) c) +++ s +| strlen c == 0 = s +| otherwise = foldr (+++) s (repeatn ((l - strlen s) / strlen c) c) join :: String [String] -> String join glue [] = "" -- cgit v1.2.3