A simple lookup to find the index of the second occurrence of the word 'is'.
ID: 843
See: IndexOf
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Text = "This is a test. It is simple.";
t.Pattern("{@Alpha}");
t.Find();
// The second 'is' starts at character position 19
var index = t.Matches.IndexOf(19);
Console.WriteLine($"The match at character 19 is at index: {index}");
Console.WriteLine($"Match content: '{t.Matches[index].Text}'");
The match at character 19 is at index: 5
Match content: 'is' using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Text = "This is a test. It is simple."; t.Pattern("{@Alpha}"); t.Find(); // The second 'is' starts at character position 19 var index = t.Matches.IndexOf(19); Console.WriteLine($"The match at character 19 is at index: {index}"); Console.WriteLine($"Match content: '{t.Matches[index].Text}'");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Text("This is a test. It is simple.");
t.Pattern("{@Alpha}");
t.Find();
// The second 'is' starts at character position 19
auto index = t.Matches().IndexOf(19);
cout << "The match at character 19 is at index: " << index << endl;
cout << "Match content: '" << t.Matches()[index].Text() << "'" << endl;
}
The match at character 19 is at index: 5
Match content: 'is' #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Text("This is a test. It is simple."); t.Pattern("{@Alpha}"); t.Find(); // The second 'is' starts at character position 19 auto index = t.Matches().IndexOf(19); cout << "The match at character 19 is at index: " << index << endl; cout << "Match content: '" << t.Matches()[index].Text() << "'" << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Text = "This is a test. It is simple."
t.Pattern("{@Alpha}")
t.Find()
'// The second 'is' starts at character position 19
Dim index = t.Matches.IndexOf(19)
Console.WriteLine($"The match at character 19 is at index: {index}")
Console.WriteLine($"Match content: '{t.Matches(index).Text}'")
End Sub
End Module
The match at character 19 is at index: 5
Match content: 'is' Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Text = "This is a test. It is simple." t.Pattern("{@Alpha}") t.Find() '// The second 'is' starts at character position 19 Dim index = t.Matches.IndexOf(19) Console.WriteLine($"The match at character 19 is at index: {index}") Console.WriteLine($"Match content: '{t.Matches(index).Text}'") End Sub End Module