QuickSnip LogoA light blue logo with a thunderbolt in bracketsQuickSnip

Remove Punctuation

Removes all punctuation from a given string.

  • string
  • punctuation
  • remove
  • clean
  • normalization

Code

import string

def remove_punctuation(s):
    return s.translate(str.maketrans('', '', string.punctuation))

Usage

main :: IO ()
main = do
    let text = "Hello, Haskell! How's it going?"
    print $ removePunctuation text -- Output: "Hello Haskell Hows it going"