A little first grader of mine with teenage brothers had a swearing problem in kindergarten so his parents and he worked to find other options besides swearing. He dropped a book on his foot and said, "Son of a nutcracker," instead of something else. Works for me.
One of my favorites is from the X-Files episode "Jose Chung's 'From Outer Space'", where the police investigator is always swearing, but the flashbacks show him saying "bleepity bleep".