Parsing text

Please discuss general Delphi programming topics here.

Parsing text

Postby m_b » July 28th, 2004, 9:57 am

How can I parse a string which looks like this:

name1=value1 name2=value2 name3=value3

and

name1: value1; name2=value2; name3=value3

and

name1=value1&name2=value2&name3=value3

Values may be quoted, like name1="value1",
but not like name1: "value1",into two variables which would be name, value: string;

I need this so I could parse HTML element attributes from text, which look like this:

<input type="submit" name=s1 value="Submit query" style="bgcolor: #ffffff; color: #000000">

And also for url parameters which look like this:

http://www.delphiarea.com/forum/posting ... wtopic&f=5

It would be nice to have a function like: GetAttribute(wholeText, attributeName: string): string;

Can anyone show me how to do this, cause I have no idea how to do it and I'm desperate??? :(

Thanks in advance...

m_b
m_b
Active Member
Active Member
 
Posts: 18
Joined: June 23rd, 2004, 10:19 am

Postby m_b » August 8th, 2004, 2:34 pm

Never mind, I solved it myself...
m_b
Active Member
Active Member
 
Posts: 18
Joined: June 23rd, 2004, 10:19 am


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 4 guests

cron