Last active
February 12, 2021 16:21
-
-
Save hanshoglund/5941143 to your computer and use it in GitHub Desktop.
Haskell String pad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
padR :: Int -> String -> String | |
padR n s | |
| length s < n = s ++ replicate (n - length s) ' ' | |
| otherwise = s | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For the benefit of anyone who stumbles across this old gist, I'd like to point out that this is a right pad, not a left pad.