Sign in to follow this  
Followers 0
aommaster

String read from a standard format?

8 posts in this topic

Hey guys!

I would like to have my program read some data from a standard format of strings. Each string has the following format:

where xxxxx could be any number of characters, and will (obviously), take the name of a color.

Is there any way to quickly extract the xxxxx out of the string, or do I need to use a combination of stringleft, stringright and stringtrim functions?

Thanks!

Share this post


Link to post
Share on other sites



_StringBetween()

see help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Wow.. you guys have thought of everything :)

Question for you: Is there any way of having this function return the first instance? Or do I have to look up the array produced directly to get that information?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This gives the 1st result...

#include <String.au3>

$String = "[color=brown]"

$String = _StringBetween($String, "[color=", "]")

If IsArray($String) Then MsgBox(0x0, "color", $String[0])

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Haha.. okay.. so I do need to get it out of the array :)

Thank you very much for your help!

Share this post


Link to post
Share on other sites

Haha.. okay.. so I do need to get it out of the array :)

Thank you very much for your help!

Welcome... Merry Xmas!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Merry Christmas to you too!

I got one more problem from this :)

The string I am trying to manipulate is this:

Finally, please post a new [color=blue][b]HijackThis[/b][/color] log, and a description of any remaining problems.

After previous manipulation the string now looks like this:

Finally, please post a new [color=blue]<b>HijackThis</b></span> log, and a description of any remaining problems.

I would like to convert:

[color=blue]
to
<span style='color:blue'>

So, I used your method with the stringbetween to get the color of the font. I have the whole span style tag ready to be switched, but I'm not sure how to replace the color=blue tag by that string. I was thinking a stringregexpreplace, but I don't want it replace any tags except those with a color statement.

Any ideas?

Thanks again :o

Share this post


Link to post
Share on other sites

Nevermind.. figured it out :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0