Forum Discussion

Marcel_Derksen_'s avatar
Marcel_Derksen_
Icon for Nimbostratus rankNimbostratus
May 02, 2006

matchclass and data groups

Hi,

 

 

I know that with a matchclass the entry in a data group. But just to verify: If a data group consists of the entry: "green 200 extra" and with that more of this kind. And I make the statement that will use matchclass with a search value "green" what will be returned by the matchclass statement? Will it return the entry with green included or will it return a not found value?

 

Marcel.

1 Reply

  • matchclass will return the index of the matched data group item. How the match is performed depends on the operator you use with the matchclass command. If you use "contains" like this

    set index [matchclass $::data_group contains "green"]

    it will return the first index that has the string "green" somewhere in it. If you use the "equals" operator,

    set index [matchclass $::data_group equals "green"]

    then it will do a full string comparison on only return the index to the data group item that is exactly "green".

    Make sense?

    -Joe