Internal Test: Verifies how filtering the matches collection affects the count.
ID: 787
See: Count
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "ID:100, Name:Admin, ID:200";
// Define two rules, but only one is marked as 'focusable'
var idRule = t.Pattern("ID:{@Number}").SetFocusable(true);
var nameRule = t.Pattern("Name:{@Alpha}").SetFocusable(false);
t.Find();
// The total count includes all matches regardless of properties
Console.WriteLine($"Total matches found: {t.Matches.Count()}");
// The count changes when we filter the list to only include focusable matches
var focusableMatches = t.GetMatches(MatchesOption.FocusableOnly);
Console.WriteLine($"Focusable matches count: {focusableMatches.Count()}");
Total matches found: 3
Focusable matches count: 2 using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Text = "ID:100, Name:Admin, ID:200"; // Define two rules, but only one is marked as 'focusable' var idRule = t.Pattern("ID:{@Number}").SetFocusable(true); var nameRule = t.Pattern("Name:{@Alpha}").SetFocusable(false); t.Find(); // The total count includes all matches regardless of properties Console.WriteLine($"Total matches found: {t.Matches.Count()}"); // The count changes when we filter the list to only include focusable matches var focusableMatches = t.GetMatches(MatchesOption.FocusableOnly); Console.WriteLine($"Focusable matches count: {focusableMatches.Count()}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Text("ID:100, Name:Admin, ID:200");
// Define two rules, but only one is marked as 'focusable'
auto idRule = t.Pattern("ID:{@Number}").SetFocusable(true);
auto nameRule = t.Pattern("Name:{@Alpha}").SetFocusable(false);
t.Find();
// The total count includes all matches regardless of properties
cout << "Total matches found: " << t.Matches().Count() << endl;
// The count changes when we filter the list to only include focusable matches
auto focusableMatches = t.GetMatches(MatchesOption::FocusableOnly);
cout << "Focusable matches count: " << focusableMatches.Count() << endl;
}
Total matches found: 3
Focusable matches count: 2 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Text("ID:100, Name:Admin, ID:200"); // Define two rules, but only one is marked as 'focusable' auto idRule = t.Pattern("ID:{@Number}").SetFocusable(true); auto nameRule = t.Pattern("Name:{@Alpha}").SetFocusable(false); t.Find(); // The total count includes all matches regardless of properties cout << "Total matches found: " << t.Matches().Count() << endl; // The count changes when we filter the list to only include focusable matches auto focusableMatches = t.GetMatches(MatchesOption::FocusableOnly); cout << "Focusable matches count: " << focusableMatches.Count() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Text = "ID:100, Name:Admin, ID:200"
'// Define two rules, but only one is marked as 'focusable'
Dim idRule = t.Pattern("ID:{@Number}").SetFocusable(true)
Dim nameRule = t.Pattern("Name:{@Alpha}").SetFocusable(false)
t.Find()
'// The total count includes all matches regardless of properties
Console.WriteLine($"Total matches found: {t.Matches.Count()}")
'// The count changes when we filter the list to only include focusable matches
Dim focusableMatches = t.GetMatches(MatchesOption.FocusableOnly)
Console.WriteLine($"Focusable matches count: {focusableMatches.Count()}")
End Sub
End Module
Total matches found: 3
Focusable matches count: 2 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Text = "ID:100, Name:Admin, ID:200" '// Define two rules, but only one is marked as 'focusable' Dim idRule = t.Pattern("ID:{@Number}").SetFocusable(true) Dim nameRule = t.Pattern("Name:{@Alpha}").SetFocusable(false) t.Find() '// The total count includes all matches regardless of properties Console.WriteLine($"Total matches found: {t.Matches.Count()}") '// The count changes when we filter the list to only include focusable matches Dim focusableMatches = t.GetMatches(MatchesOption.FocusableOnly) Console.WriteLine($"Focusable matches count: {focusableMatches.Count()}") End Sub End Module