mardi 29 octobre 2019

What is the appropriate design pattern for multiple replacing of specific text or characters

I have a requirement to replace numeric,html tags, and special characters. I have created a method for each purpose. For example I have created methods for ReplaceSpecialCharacters, ReplaceHTMLTags and ReplaceNumeric. And take note there are some additional replace methods that are coming in. My question is what is the appropriate design pattern for this?

sample code
var text="12233333333<body>CLEANTEXT!@#$%^&*()</body>"
var cleanText= ReplaceHTMLTags(text)
    cleanText= ReplaceNumeric(cleaText)
    cleanText= ReplaceSpecialCharacters(cleaText)

Aucun commentaire:

Enregistrer un commentaire