Demonstrates the basic difference between getting all matches and filtering for only 'focusable' ones.
ID: 1080
See: GetMatches
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.Text = "ID:100, Name:Admin, ID:200";
// Define two rules, but only one is marked as 'focusable'
t.Pattern("ID:{@Number}").SetFocusable(true);
t.Pattern("Name:{@Alpha}").SetFocusable(false);
t.Find();
// Get all matches using the default option
var allMatches = t.GetMatches();
Console.WriteLine($"--- All Matches ({allMatches.Count()}) ---");
Console.WriteLine(allMatches.Text);
// Get only the focusable matches
var focusableMatches = t.GetMatches(MatchesOption.FocusableOnly);
Console.WriteLine("");
Console.WriteLine($"--- Focusable Matches Only ({focusableMatches.Count()}) ---");
Console.WriteLine(focusableMatches.Text);
--- All Matches (3) ---
ID:100
Name:Admin
ID:200
--- Focusable Matches Only (2) ---
ID:100
ID:200 using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.Text = "ID:100, Name:Admin, ID:200"; // Define two rules, but only one is marked as 'focusable' t.Pattern("ID:{@Number}").SetFocusable(true); t.Pattern("Name:{@Alpha}").SetFocusable(false); t.Find(); // Get all matches using the default option var allMatches = t.GetMatches(); Console.WriteLine($"--- All Matches ({allMatches.Count()}) ---"); Console.WriteLine(allMatches.Text); // Get only the focusable matches var focusableMatches = t.GetMatches(MatchesOption.FocusableOnly); Console.WriteLine(""); Console.WriteLine($"--- Focusable Matches Only ({focusableMatches.Count()}) ---"); Console.WriteLine(focusableMatches.Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.Text("ID:100, Name:Admin, ID:200");
// Define two rules, but only one is marked as 'focusable'
t.Pattern("ID:{@Number}").SetFocusable(true);
t.Pattern("Name:{@Alpha}").SetFocusable(false);
t.Find();
// Get all matches using the default option
auto allMatches = t.GetMatches();
cout << "--- All Matches (" << allMatches.Count() << ") ---" << endl;
cout << allMatches.Text() << endl;
// Get only the focusable matches
auto focusableMatches = t.GetMatches(MatchesOption::FocusableOnly);
cout << "" << endl;
cout << "--- Focusable Matches Only (" << focusableMatches.Count() << ") ---" << endl;
cout << focusableMatches.Text() << endl;
}
--- All Matches (3) ---
ID:100
Name:Admin
ID:200
--- Focusable Matches Only (2) ---
ID:100
ID:200 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.Text("ID:100, Name:Admin, ID:200"); // Define two rules, but only one is marked as 'focusable' t.Pattern("ID:{@Number}").SetFocusable(true); t.Pattern("Name:{@Alpha}").SetFocusable(false); t.Find(); // Get all matches using the default option auto allMatches = t.GetMatches(); cout << "--- All Matches (" << allMatches.Count() << ") ---" << endl; cout << allMatches.Text() << endl; // Get only the focusable matches auto focusableMatches = t.GetMatches(MatchesOption::FocusableOnly); cout << "" << endl; cout << "--- Focusable Matches Only (" << focusableMatches.Count() << ") ---" << endl; cout << focusableMatches.Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.Text = "ID:100, Name:Admin, ID:200"
'// Define two rules, but only one is marked as 'focusable'
t.Pattern("ID:{@Number}").SetFocusable(true)
t.Pattern("Name:{@Alpha}").SetFocusable(false)
t.Find()
'// Get all matches using the default option
Dim allMatches = t.GetMatches()
Console.WriteLine($"--- All Matches ({allMatches.Count()}) ---")
Console.WriteLine(allMatches.Text)
'// Get only the focusable matches
Dim focusableMatches = t.GetMatches(MatchesOption.FocusableOnly)
Console.WriteLine("")
Console.WriteLine($"--- Focusable Matches Only ({focusableMatches.Count()}) ---")
Console.WriteLine(focusableMatches.Text)
End Sub
End Module
--- All Matches (3) ---
ID:100
Name:Admin
ID:200
--- Focusable Matches Only (2) ---
ID:100
ID:200 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.Text = "ID:100, Name:Admin, ID:200" '// Define two rules, but only one is marked as 'focusable' t.Pattern("ID:{@Number}").SetFocusable(true) t.Pattern("Name:{@Alpha}").SetFocusable(false) t.Find() '// Get all matches using the default option Dim allMatches = t.GetMatches() Console.WriteLine($"--- All Matches ({allMatches.Count()}) ---") Console.WriteLine(allMatches.Text) '// Get only the focusable matches Dim focusableMatches = t.GetMatches(MatchesOption.FocusableOnly) Console.WriteLine("") Console.WriteLine($"--- Focusable Matches Only ({focusableMatches.Count()}) ---") Console.WriteLine(focusableMatches.Text) End Sub End Module