How to assign and retrieve descriptions for specific transformation patterns using SetDescription().
ID: 118
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Str("Title
Bold statementTitle B
Other textMy paragraph
");
var AnyOtherTag = t.Pattern("<{tag}>{text}{tag}>").SetDescription("other kind of tag");
var BoldTag = t.Pattern("{text}").SetDescription("bold tag");
var H3Tag = t.Pattern("{text}
").SetDescription("h3 tag");
t.Find();
foreach(var match in t.Matches) {
Console.WriteLine(match.Text + " Description: " + match.Rule.Description);
}
<h3>Title</h3> Description: h3 tag
<b>Bold statement</b> Description: bold tag
<h3>Title B</h3> Description: h3 tag
<b>Other text</b> Description: bold tag
<p>My paragraph</p> Description: other kind of tag using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Str("<h3>Title</h3><b>Bold statement</b><h3>Title B</h3><b>Other text</b><p>My paragraph</p>"); var AnyOtherTag = t.Pattern("<{tag}>{text}</{tag}>").SetDescription("other kind of tag"); var BoldTag = t.Pattern("<b>{text}</b>").SetDescription("bold tag"); var H3Tag = t.Pattern("<h3>{text}</h3>").SetDescription("h3 tag"); t.Find(); foreach(var match in t.Matches) { Console.WriteLine(match.Text + " Description: " + match.Rule.Description); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Str("Title
Bold statementTitle B
Other textMy paragraph
");
auto AnyOtherTag = t.Pattern("<{tag}>{text}{tag}>").SetDescription("other kind of tag");
auto BoldTag = t.Pattern("{text}").SetDescription("bold tag");
auto H3Tag = t.Pattern("{text}
").SetDescription("h3 tag");
t.Find();
for(auto match : t.Matches()) {
cout << match.Text() + " Description: " + match.Rule().Description() << endl;
}
}
<h3>Title</h3> Description: h3 tag
<b>Bold statement</b> Description: bold tag
<h3>Title B</h3> Description: h3 tag
<b>Other text</b> Description: bold tag
<p>My paragraph</p> Description: other kind of tag #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Str("<h3>Title</h3><b>Bold statement</b><h3>Title B</h3><b>Other text</b><p>My paragraph</p>"); auto AnyOtherTag = t.Pattern("<{tag}>{text}</{tag}>").SetDescription("other kind of tag"); auto BoldTag = t.Pattern("<b>{text}</b>").SetDescription("bold tag"); auto H3Tag = t.Pattern("<h3>{text}</h3>").SetDescription("h3 tag"); t.Find(); for(auto match : t.Matches()) { cout << match.Text() + " Description: " + match.Rule().Description() << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Str("Title
Bold statementTitle B
Other textMy paragraph
")
Dim AnyOtherTag = t.Pattern("<{tag}>{text}{tag}>").SetDescription("other kind of tag")
Dim BoldTag = t.Pattern("{text}").SetDescription("bold tag")
Dim H3Tag = t.Pattern("{text}
").SetDescription("h3 tag")
t.Find()
For Each match In t.Matches
Console.WriteLine(match.Text + " Description: " + match.Rule.Description)
Next
End Sub
End Module
<h3>Title</h3> Description: h3 tag
<b>Bold statement</b> Description: bold tag
<h3>Title B</h3> Description: h3 tag
<b>Other text</b> Description: bold tag
<p>My paragraph</p> Description: other kind of tag Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Str("<h3>Title</h3><b>Bold statement</b><h3>Title B</h3><b>Other text</b><p>My paragraph</p>") Dim AnyOtherTag = t.Pattern("<{tag}>{text}</{tag}>").SetDescription("other kind of tag") Dim BoldTag = t.Pattern("<b>{text}</b>").SetDescription("bold tag") Dim H3Tag = t.Pattern("<h3>{text}</h3>").SetDescription("h3 tag") t.Find() For Each match In t.Matches Console.WriteLine(match.Text + " Description: " + match.Rule.Description) Next End Sub End Module