How to extract text that appears after a specific pattern using the String.After() method.

ID: 105

See: After
				
					using uCalcSoftware;

var uc = new uCalc();
uCalc.String s = "This is just a test";
Console.WriteLine(s.After("is"));

s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;";
Console.WriteLine(s.After("if ({cond})"));
Console.WriteLine(s.After("if ({cond})").After("if ({cond})"));
Console.WriteLine(s.After("if ({cond})", 2)); // Finds text after 2nd match (same as above)
Console.WriteLine(s.After("NonExistingPattern")); // Nothing to display on this line
Console.WriteLine("----");

				
			
 just a test
 y = x * 2; else if(x == 5) y = x - 1;
 y = x - 1;
 y = x - 1;

----
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::String s = "This is just a test";
   cout << s.After("is") << endl;

   s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;";
   cout << s.After("if ({cond})") << endl;
   cout << s.After("if ({cond})").After("if ({cond})") << endl;
   cout << s.After("if ({cond})", 2) << endl; // Finds text after 2nd match (same as above)
   cout << s.After("NonExistingPattern") << endl; // Nothing to display on this line
   cout << "----" << endl;

}
				
			
 just a test
 y = x * 2; else if(x == 5) y = x - 1;
 y = x - 1;
 y = x - 1;

----
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim s As uCalc.String = "This is just a test"
      Console.WriteLine(s.After("is"))
      
      s = "/* if else */ if (x > 100) y = x * 2; else if(x == 5) y = x - 1;"
      Console.WriteLine(s.After("if ({cond})"))
      Console.WriteLine(s.After("if ({cond})").After("if ({cond})"))
      Console.WriteLine(s.After("if ({cond})", 2)) '// Finds text after 2nd match (same as above)
      Console.WriteLine(s.After("NonExistingPattern")) '// Nothing to display on this line
      Console.WriteLine("----")
      
   End Sub
End Module
				
			
 just a test
 y = x * 2; else if(x == 5) y = x - 1;
 y = x - 1;
 y = x - 1;

----