Extracts all log entries from the second 'ERROR' onwards, demonstrating how the `occurrence` parameter skips initial matches.
ID: 1279
See: StartingFrom
using uCalcSoftware;
var uc = new uCalc();
using (var log = new uCalc.String("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.")) {
// Find the second occurrence of "ERROR" and get everything after it.
var remainingLog = log.StartingFrom("ERROR", 2);
Console.WriteLine(remainingLog);
}
ERROR: Fail 2. using uCalcSoftware; var uc = new uCalc(); using (var log = new uCalc.String("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.")) { // Find the second occurrence of "ERROR" and get everything after it. var remainingLog = log.StartingFrom("ERROR", 2); Console.WriteLine(remainingLog); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::String log("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.");
log.Owned(); // Causes log to be released when it goes out of scope
// Find the second occurrence of "ERROR" and get everything after it.
auto remainingLog = log.StartingFrom("ERROR", 2);
cout << remainingLog << endl;
}
}
ERROR: Fail 2. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::String log("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2."); log.Owned(); // Causes log to be released when it goes out of scope // Find the second occurrence of "ERROR" and get everything after it. auto remainingLog = log.StartingFrom("ERROR", 2); cout << remainingLog << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using log As New uCalc.String("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.")
'// Find the second occurrence of "ERROR" and get everything after it.
Dim remainingLog = log.StartingFrom("ERROR", 2)
Console.WriteLine(remainingLog)
End Using
End Sub
End Module
ERROR: Fail 2. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using log As New uCalc.String("INFO: OK. ERROR: Fail 1. INFO: OK. ERROR: Fail 2.") '// Find the second occurrence of "ERROR" and get everything after it. Dim remainingLog = log.StartingFrom("ERROR", 2) Console.WriteLine(remainingLog) End Using End Sub End Module