diff options
author | Camil Staps | 2015-07-03 23:39:40 +0200 |
---|---|---|
committer | Camil Staps | 2015-07-03 23:41:02 +0200 |
commit | f0ed4df2b0e11ab66966a8395cd7d6d29c7a8efc (patch) | |
tree | ecdfbd232e1710f67c233c3e4281560f0344a10c /StringUtils.icl | |
parent | Installation (diff) |
Latex & Html output options
Diffstat (limited to 'StringUtils.icl')
-rw-r--r-- | StringUtils.icl | 10 |
1 files changed, 6 insertions, 4 deletions
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 [] = "" |