Replacing special characters

connexion

Registered User.
Local time
Today, 06:31
Joined
Jul 30, 2003
Messages
72
I have some data received in the body of an email that i am trying to "clean".

TABs or Carriage Returns (or both) are causing me a problem because although easy using find and replace from the menu bar, i can't seem to see exactly what to represent them with in code to automate their removal.

They appear as squares in the table text when mail text is imported into a table. Find and replace from the menu bar can identify them because all i'm doing is copying one into the find box (it appears as 6 spaces) and replace them with nothing.

However i want to do this in code so can anyone tell me how to reference them so that i can remove them please.

Thanks

Vince
 
use the chr() function ie chr(10) return a linefeed

for intCounter = 1 to len(myString)
if mid$(Mystring,1,intcounter) = chr(10) then
endif
next
 
If you have it in a string variable, here are a couple of operations to try:

mystring = replace(mystring, vbcrlf, vbnullstring)
' replace any occurance of carriage return/line feed with zls

if there's only carriage return, then
mystring = replace(mystring, vbcr, vbnullstring)

for tab
mystring = replace(mystring, vbtab, vbnullstring)
 
Thanks for that.
The text was a bt of a jumble containing tabs, line feeds etc, etc.
In the end replaced unwanted characters by refering to them by their ASCII number. Your method looks better and makes what is being replaced more obvious so i'll amend mine to this.

Thanks

Vince
 

Users who are viewing this thread

Back
Top Bottom