Finding all occurrences of a specific word.
ID: 1065
See: Find
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.Text = "apple banana apple cherry apple";
t.Pattern("apple");
t.Find();
Console.WriteLine($"Found {t.Matches.Count()} occurrences of 'apple'.");
Found 3 occurrences of 'apple'. using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.Text = "apple banana apple cherry apple"; t.Pattern("apple"); t.Find(); Console.WriteLine($"Found {t.Matches.Count()} occurrences of 'apple'.");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.Text("apple banana apple cherry apple");
t.Pattern("apple");
t.Find();
cout << "Found " << t.Matches().Count() << " occurrences of 'apple'." << endl;
}
Found 3 occurrences of 'apple'. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.Text("apple banana apple cherry apple"); t.Pattern("apple"); t.Find(); cout << "Found " << t.Matches().Count() << " occurrences of 'apple'." << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.Text = "apple banana apple cherry apple"
t.Pattern("apple")
t.Find()
Console.WriteLine($"Found {t.Matches.Count()} occurrences of 'apple'.")
End Sub
End Module
Found 3 occurrences of 'apple'. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.Text = "apple banana apple cherry apple" t.Pattern("apple") t.Find() Console.WriteLine($"Found {t.Matches.Count()} occurrences of 'apple'.") End Sub End Module