How to get the text of the first match found.
ID: 832
See: Text = [string]
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "The quick brown fox";
t.Pattern("brown");
t.Find();
// Get the collection of matches
var matches = t.Matches;
// Check if any matches were found
// Get the first match object and retrieve its text
var firstMatch = matches[0];
Console.WriteLine($"Found match: '{firstMatch.Text}'");
Found match: 'brown' using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Text = "The quick brown fox"; t.Pattern("brown"); t.Find(); // Get the collection of matches var matches = t.Matches; // Check if any matches were found // Get the first match object and retrieve its text var firstMatch = matches[0]; Console.WriteLine($"Found match: '{firstMatch.Text}'");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Text("The quick brown fox");
t.Pattern("brown");
t.Find();
// Get the collection of matches
auto matches = t.Matches();
// Check if any matches were found
// Get the first match object and retrieve its text
auto firstMatch = matches[0];
cout << "Found match: '" << firstMatch.Text() << "'" << endl;
}
Found match: 'brown' #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Text("The quick brown fox"); t.Pattern("brown"); t.Find(); // Get the collection of matches auto matches = t.Matches(); // Check if any matches were found // Get the first match object and retrieve its text auto firstMatch = matches[0]; cout << "Found match: '" << firstMatch.Text() << "'" << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Text = "The quick brown fox"
t.Pattern("brown")
t.Find()
'// Get the collection of matches
Dim matches = t.Matches
'// Check if any matches were found
'// Get the first match object and retrieve its text
Dim firstMatch = matches(0)
Console.WriteLine($"Found match: '{firstMatch.Text}'")
End Sub
End Module
Found match: 'brown' Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Text = "The quick brown fox" t.Pattern("brown") t.Find() '// Get the collection of matches Dim matches = t.Matches '// Check if any matches were found '// Get the first match object and retrieve its text Dim firstMatch = matches(0) Console.WriteLine($"Found match: '{firstMatch.Text}'") End Sub End Module