diff 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 [] = "" |