• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

How do I replace "&" in vb6?

hi, I know that

strFormattedString = Replace(strUnformattedString, Chr(39), "")
  GetCleanString = strFormattedString

will replace an apostrophe with a blank, but is there a # that will replace an ampersand?   My XML document is not happy with them in it...  
  Thanks in advance!

 -Al
0
afeld
Asked:
afeld
  • 4
  • 2
1 Solution
 
DagorCommented:
You can also use the common name for this as follows:

strFormattedString = Replace(strUnformattedString, "&", "")
 GetCleanString = strFormattedString
0
 
afeldAuthor Commented:
I tried that, and it still returned an XML document with the same error...  
0
 
Chuckie_IceCommented:
to answer this in the way your looking for, & = 38

strFormattedString = Replace(strUnformattedString, Chr$(38), "")
GetCleanString = strFormattedString

Also, i used Chr$(38) instead of Chr(38),this may help
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Chuckie_IceCommented:
to answer this in the way your looking for, & = 38

strFormattedString = Replace(strUnformattedString, Chr$(38), "")
GetCleanString = strFormattedString

Also, i used Chr$(38) instead of Chr(38),this may help
0
 
afeldAuthor Commented:
I tried that, and it still returned an XML document with the same error...  
0
 
afeldAuthor Commented:
Still no luck...  
0
 
afeldAuthor Commented:
whoops, I am stupid.  I was cleaning it for &'s and for apostrophes, and it went back to the & before the second clean.   It works now.  Thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now