Retrieving the text of the first match found in a simple search.
ID: 837
See: Text = [string]
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "The price is $19.99 today.";
t.Pattern("{@Number}"); // Find the first number
t.Find();
// Get the collection of matches
var matches = t.Matches;
// Check if any match was found and get its text
if (matches.Count() > 0) {
Console.WriteLine(matches[0].Text);
}
19.99 using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Text = "The price is $19.99 today."; t.Pattern("{@Number}"); // Find the first number t.Find(); // Get the collection of matches var matches = t.Matches; // Check if any match was found and get its text if (matches.Count() > 0) { Console.WriteLine(matches[0].Text); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Text("The price is $19.99 today.");
t.Pattern("{@Number}"); // Find the first number
t.Find();
// Get the collection of matches
auto matches = t.Matches();
// Check if any match was found and get its text
if (matches.Count() > 0) {
cout << matches[0].Text() << endl;
}
}
19.99 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Text("The price is $19.99 today."); t.Pattern("{@Number}"); // Find the first number t.Find(); // Get the collection of matches auto matches = t.Matches(); // Check if any match was found and get its text if (matches.Count() > 0) { cout << matches[0].Text() << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Text = "The price is $19.99 today."
t.Pattern("{@Number}") '// Find the first number
t.Find()
'// Get the collection of matches
Dim matches = t.Matches
'// Check if any match was found and get its text
If matches.Count() > 0 Then
Console.WriteLine(matches(0).Text)
End If
End Sub
End Module
19.99 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Text = "The price is $19.99 today." t.Pattern("{@Number}") '// Find the first number t.Find() '// Get the collection of matches Dim matches = t.Matches '// Check if any match was found and get its text If matches.Count() > 0 Then Console.WriteLine(matches(0).Text) End If End Sub End Module