Hi,

<DIV style="POSITION: absolute; TEXT-ALIGN: center; FONT-STYLE: normal; WIDTH: 141px; FONT-FAMILY: Arial; WHITE-SPACE: nowrap; HEIGHT: 76px; FONT-SIZE: 12pt; TOP: 268px; FONT-WEIGHT: 400; TEXT-DECORATION: none; ctrlProp="acknowledged:true;showDisableIcon:True;showTooltip:True;sizeableIcon:True;"></DIV>

Consider the above string, Now I want to know the value of sizeableIcon (Either true/false),showDisableIcon (either true /false). Is there any way to pick those values.

Note: I don't want to use split(";") method. It should be professional way.

Perhaps learning regular expressions or LINQ can help.

try something like:

        dim substart,subend as Integer
        dim originalstring,newstring,searchstring as string

            'Set search term
            searchstring = "showDisableIcon"

            'find the start of the string you want to extract
            substart= originalstring.indexof(searchstring)

            'find the end of the string you want to extract
            subend= originalstring.indexof(';', substart)

            'newstring should contain the string your looking for.  
            newstring = originalstring.substring(substart,subend)

            'Check for boolean value.
            if newstring.contains("True") then
                'do stuff
            else
                'do other stuff
            endif

This was done without an IDE, syntax may not be 100%.

@tinstaafi: did you not notice, this is the C# forum not the VB.NET forum?
Don't worry, I made the same mistake once, and I still live! :)

Something like

String str = //your string here 
MatchCollection matches = Regex.Matches(str, "(?<=sizeableIcon:)(.*?)(?=;)");
foreach (Match match in matches) {
   //do something with each match
}

oops, an attack of braindeadedness lol. Here this one should be better.

    int substart=0,subend=0;
    string originalstring,newstring,searchstring;

    //Set your original string
    originalstring="<DIV style="POSITION: absolute; TEXT-ALIGN: center; FONT-STYLE: normal; WIDTH: 141px; FONT-FAMILY: Arial; WHITE-SPACE: nowrap; HEIGHT: 76px; FONT-SIZE: 12pt; TOP: 268px; FONT-WEIGHT: 400; TEXT-DECORATION: none; ctrlProp="acknowledged:true;showDisableIcon:True;showTooltip:True;sizeableIcon:True;"></DIV>"

    //Set search term
    searchstring = "showDisableIcon";

    //find the start of the string you want to extract
    substart= originalstring.indexof(searchstring);

    //find the end of the string you want to extract
    subend= originalstring.indexof(';', substart);

    //newstring should contain the string your looking for.
    newstring = originalstring.substring(substart,subend);

    //Check for boolean value.
    if (newstring.contains("True"))
    {
    'do stuff
    }
    else
    {
    'do other stuff
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.