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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String manipulation 1

Status
Not open for further replies.

AP81

Programmer
Apr 11, 2003
740
AU
I have an XML stream parsed from Quickbooks and I want to retrieve certain information from the stream. Basically move through the document and take information from within the XML tags. In VB, I could use:

intStart = strStream.IndexOf(&quot;<Customer>&quot;)
intEnd = strStream.IndexOf(&quot;</Customer>&quot;)
'take string between Start and End
strTxt = strStream.SubString(intStart , intEnd)
//shorten string to start from last position
strStream = strStream.SubString(intEnd)
...
etc.

How can I do this in Delphi?
I can copy buy using:
Copy(strStream, intStart, intEnd);
I am not sure of the rest...

Is there a more efficient way of doing this, seeing as the string is several thousand characters?





------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
If your initial string of XML has Carriage Return/Line Feeds in it, you can load it into a TStringList and parse it line by line.

If you want to find where a substring is located within a string, use the Pos() function.

-D
 
Thanks hilfy, spot on.




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
Check out
How to operate with Strings
faq102-3583 in the FAQ area

Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top