Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String manipulation 2

Status
Not open for further replies.

dashen

Programmer
Jul 14, 2005
233
US
I posted earlier on how I needed to convert an XML I created into a String format for some vendor software. I have done that thanks to earthanfire's help.

Problem is the vendor software is being very picky. It doesn't even seem to like the encoding tag for XML, which makes no sense because they require it to be in an XML format.

Code:
<?xml version="1.0" encoding="utf-8"?>

Is there any String manipulation functions that I can use to do this? Is it supposed to be Split?

Code:
Split(filecontents,"<?xml version='1.0' encoding='utf-8'?>")

Is this the correct way to do this? It returns an array of strings, so how do I reference the first instance.
 
Do you mean that you want to remove:

<?xml version="1.0" encoding="utf-8"?>

from the string.


If so you could use the Replace function, replacing that with "".

Aternatively, if you are using Split and I assume that the offending string is the first string and only occurs once, then:

Dim strings() as string = source.Split(etc)
Dim NewString as string = strings(1)


By the way don't forget to double the " symbol when embedding it.


Hope this helps.

[vampire][bat]
 
Are you just trying to remove that tag? If so, use replace:

MyString = MyString.Replace("<?xml version=""1.0"" encoding=""utf-8""?>", "")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top