Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention. Check out this how-to article for more information.
Function ReplaceBadWords(InputComments) Dim badChars, newChars, sLength, sAttachtoEnd, x, i 'create an array of bad words that should be filtered badChars = array("rubbish", "crap", "shit", "cunt", "bastard", "prick", "fuck") newChars = InputComments 'loop through our array of bad words For i = 0 to uBound(badChars) 'get the length of the bad word sLength=Len(badChars(i)) 'we are going to keep the first letter of the bad word and replace all the other 'letters with *, so we need to find out how many * to use For x=1 to sLength-1 sAttachtoEnd=sAttachtoEnd & "*" Next 'replace any occurences of the bad word with the first letter of it and the 'rest of the letters replace with * newChars = Replace(newChars, badChars(i), Left(badChars(i),1) & sAttachtoEnd) sAttachtoEnd="" Next ReplaceBadWords = newChars End function
Join the community of 500,000 technology professionals and ask your questions.