ComponentOne VSFlexGrid 8.0
TagString Property

Returns or sets the string corresponding to the current tag.

Syntax

[form!]VSFlexString.TagString([ TagIndex As Long ])[ = value As String ]

Remarks

Tags are parts of the search pattern delimited with curly braces ("{}"). Using tags allow you to refer to parts of each match. You can retrieve information about each tag by reading the TagLength, TagStart, and TagString properties.

The optional parameter MatchIndex should be a number between zero and TagCount - 1. The default value is the current value of the TagIndex property.

The following example shows how you can use tags to extract additional information from each match:

fs.Text = "Mary had a little lamb, Joe has a Porsche, " & vbCrLf & _

"Matt has problems..., Mike will have many options, " & vbCrLf & _

"Bill had better stop smoking, And I have a headache!"

 fs.Pattern = "{[A-Z][a-z]*} ha[dsv]e? [ a]*{[A-Za-z ]+}" ' who had/has/have stuff?

For i = 0 To fs.MatchCount – 1

    fs.MatchIndex = i

    Debug.Print fs.TagString(1) & " BELONGS TO " & fs.TagString(0)

Next

This code produces the following output:

little lamb BELONGS TO Mary

Porsche BELONGS TO Joe

problems BELONGS TO Matt

better stop smoking BELONGS TO Bill

headache BELONGS TO I

If you assign a new string to the TagString property, VSFlexString will modify the string in the Text property and will attempt a new match. For example:

 fs.Text = "The quick brown fox jumped over the lazy dog."

 fs.Pattern = "{[A-Za-z]}[a-z]*"

 For i = 0 To fs.MatchCount - 1

     fs.MatchIndex = i

     fs.TagString(0) = UCase(fs.TagString(0))

 Next

 Debug.Print fs

This code produces the following output:

The Quick Brown Fox Jumped Over The Lazy Dog.

Data Type

String

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback