A basic demonstration of toggling the Focusable flag to filter a list of matches.
ID: 874
See: Focusable = [bool]
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "A B C";
var ruleA = t.Pattern("A").SetFocusable(true);
var ruleB = t.Pattern("B").SetFocusable(true);
var ruleC = t.Pattern("C").SetFocusable(false); // C is not focusable
t.Find();
Console.WriteLine("--- All Matches ---");
Console.WriteLine(t.GetMatches(MatchesOption.All).Text);
Console.Write("--- Focusable Matches ---");
// This list will exclude the match for 'C'.
Console.WriteLine(t.GetMatches(MatchesOption.FocusableOnly).Text);
--- All Matches ---
A
B
C
--- Focusable Matches ---A
B using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Text = "A B C"; var ruleA = t.Pattern("A").SetFocusable(true); var ruleB = t.Pattern("B").SetFocusable(true); var ruleC = t.Pattern("C").SetFocusable(false); // C is not focusable t.Find(); Console.WriteLine("--- All Matches ---"); Console.WriteLine(t.GetMatches(MatchesOption.All).Text); Console.Write("--- Focusable Matches ---"); // This list will exclude the match for 'C'. Console.WriteLine(t.GetMatches(MatchesOption.FocusableOnly).Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Text("A B C");
auto ruleA = t.Pattern("A").SetFocusable(true);
auto ruleB = t.Pattern("B").SetFocusable(true);
auto ruleC = t.Pattern("C").SetFocusable(false); // C is not focusable
t.Find();
cout << "--- All Matches ---" << endl;
cout << t.GetMatches(MatchesOption::All).Text() << endl;
cout << "--- Focusable Matches ---";
// This list will exclude the match for 'C'.
cout << t.GetMatches(MatchesOption::FocusableOnly).Text() << endl;
}
--- All Matches ---
A
B
C
--- Focusable Matches ---A
B #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Text("A B C"); auto ruleA = t.Pattern("A").SetFocusable(true); auto ruleB = t.Pattern("B").SetFocusable(true); auto ruleC = t.Pattern("C").SetFocusable(false); // C is not focusable t.Find(); cout << "--- All Matches ---" << endl; cout << t.GetMatches(MatchesOption::All).Text() << endl; cout << "--- Focusable Matches ---"; // This list will exclude the match for 'C'. cout << t.GetMatches(MatchesOption::FocusableOnly).Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Text = "A B C"
Dim ruleA = t.Pattern("A").SetFocusable(true)
Dim ruleB = t.Pattern("B").SetFocusable(true)
Dim ruleC = t.Pattern("C").SetFocusable(false) '// C is not focusable
t.Find()
Console.WriteLine("--- All Matches ---")
Console.WriteLine(t.GetMatches(MatchesOption.All).Text)
Console.Write("--- Focusable Matches ---")
'// This list will exclude the match for 'C'.
Console.WriteLine(t.GetMatches(MatchesOption.FocusableOnly).Text)
End Sub
End Module
--- All Matches ---
A
B
C
--- Focusable Matches ---A
B Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Text = "A B C" Dim ruleA = t.Pattern("A").SetFocusable(true) Dim ruleB = t.Pattern("B").SetFocusable(true) Dim ruleC = t.Pattern("C").SetFocusable(false) '// C is not focusable t.Find() Console.WriteLine("--- All Matches ---") Console.WriteLine(t.GetMatches(MatchesOption.All).Text) Console.Write("--- Focusable Matches ---") '// This list will exclude the match for 'C'. Console.WriteLine(t.GetMatches(MatchesOption.FocusableOnly).Text) End Sub End Module