Michelle Aycoth
asked on
String manipulation in Visual Basic
Hi,
I've been reading about the Split functions but I have a split on two different characters within a text file.
The string to parse is <FILENAME>123456789.TIF</F ILENAME>
I would like to only extract the information between > and </. I realize this is xml format, but the document is not an XML document. The length of the value can vary in size.
Does anyone have any examples or can point me in the right direction? I've not had any luck so far. Thanks, Michelle
I've been reading about the Split functions but I have a split on two different characters within a text file.
The string to parse is <FILENAME>123456789.TIF</F
I would like to only extract the information between > and </. I realize this is xml format, but the document is not an XML document. The length of the value can vary in size.
Does anyone have any examples or can point me in the right direction? I've not had any luck so far. Thanks, Michelle
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Some explanation of my code is probably called for. The "Replace" portion of the above changes all ">" to "<" to make what the Split command splits on consistent. Then the (2) portion returns the 3rd entry in the array that Split returns. (0) would be a blank because there's nothing in front of the first "<" in the modified string, and (1) would be FILENAME.
ASKER
Thanks for the quick responses. I didn't realize I could split on a split. Thought I had to do some sort of substring configuration.
I assume you were responding to Kimputer. You don't need to Split on Split. Please see my post ID: 41818694.
ASKER
Thanks so much for the quick response.
You're welcome and I'm glad I was able to help.
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
Open in new window
If it's part of a bigger line (or not formatted as predictable), use regex instead.