Find & replace strange character

Hi

I am trying to remove a character that I thought was a carriage return from a field. But nothing I do works. I have a function that is supposed to work but doesn’t, I’ve tried evaluate with @ReplaceSubstring but it doesn’t work either.

Here is the string of text, I tought the character was a chr(13) or chr(10)

"JANE DOE JOHN DOE "

Here is the find&replace function i’m using

Function ReplaceSubstring(text As String, tag As String, tval As String) As String

’ Simple Search and Replace function with 3 arguments (if “tag” is not found, “text” will be returned unmodified)

’ text : the text to search in

’ tag : the existing text or string we are looking for in “text”

’ tval : the value that will replace tag

While Instr(1, text, tag) > 0

	If Instr(1, text, tag) = 1 Then

		text$ = tval$ & Mid(text$, Instr(text$, tag$)+Len(tag$))

	Else

		text$ = Mid(text$, 1, Instr(text$, tag$)-1) & tval$ & Mid(text$, Instr(text$, tag$)+Len(tag$))

	End If

Wend



ReplaceSubstring=text$

End Function

Any ideas at all???

Subject: Identifying the strange characters

Hi Jane, if you’re not sure what the strange characters are, may be best to identify them first.Do a little for loop to go through each character of the string and print the ascii value of the string (ASC(character)). Once you’re sure what it is, you should be able to do a simple replace with CHR(value).

hth

Tony

Subject: Might be better to use the UNI function

since those might not be ASCII characters.

Incidentally, I don’t see any problem with your ReplaceSubstring function but wonder why you’re not using the built-in Replace function.