|
-
Jul 18th, 2012, 06:54 PM
#1
Thread Starter
Frenzied Member
String Retrieval
I have a string like this:
font-family:Arial;font-size:10px;color:green;
I would like to retrieve the string like this:
Arial;10px;green
How do I accomplish this ?
-
Jul 18th, 2012, 09:01 PM
#2
Re: String Retrieval
Do you use regular expressions or would string functions be better?
The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded. 
-
Jul 19th, 2012, 12:59 AM
#3
Re: String Retrieval
Hello,
Am I right in saying that you are parsing HTML that you are getting from "somewhere"?
If so, you might want to take a look at the HTMLAgilityPack:
http://htmlagilitypack.codeplex.com/
Which I am fairly sure has methods for getting at this data.
Gary
-
Jul 19th, 2012, 06:16 AM
#4
Re: String Retrieval
You can use Regular expressions for your purpose. This is possible both ways - javascript as well as server side asp.net code, since both support Regular experessions in one form or the other.
The following Regex expression will help get you the relevent parts:
Here's the strategy:
Use the regex expression I provided above to get the required parts. You will obviously get them in separate groups/sub-groups. All you need to do after that is to join/concatenate them with a semi-colon in between.
Let me know if you need some sample code and I'll try to quickly construct one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|