A basic example to get the starting index of a single word.
ID: 829
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.Text = "Hello World";
t.Pattern("World");
t.Find();
var matches = t.Matches;
Console.WriteLine($"Match found at position: {matches[0].StartPosition}");
Match found at position: 6 using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.Text = "Hello World"; t.Pattern("World"); t.Find(); var matches = t.Matches; Console.WriteLine($"Match found at position: {matches[0].StartPosition}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.Text("Hello World");
t.Pattern("World");
t.Find();
auto matches = t.Matches();
cout << "Match found at position: " << matches[0].StartPosition() << endl;
}
Match found at position: 6 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.Text("Hello World"); t.Pattern("World"); t.Find(); auto matches = t.Matches(); cout << "Match found at position: " << matches[0].StartPosition() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.Text = "Hello World"
t.Pattern("World")
t.Find()
Dim matches = t.Matches
Console.WriteLine($"Match found at position: {matches(0).StartPosition}")
End Sub
End Module
Match found at position: 6 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.Text = "Hello World" t.Pattern("World") t.Find() Dim matches = t.Matches Console.WriteLine($"Match found at position: {matches(0).StartPosition}") End Sub End Module