Skip to content

Instantly share code, notes, and snippets.

@hanshoglund
Last active February 12, 2021 16:21
Show Gist options
  • Save hanshoglund/5941143 to your computer and use it in GitHub Desktop.
Save hanshoglund/5941143 to your computer and use it in GitHub Desktop.
Haskell String pad
padR :: Int -> String -> String
padR n s
| length s < n = s ++ replicate (n - length s) ' '
| otherwise = s
@andrewthad
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment