Chains `Before` and `Replace` to modify only the scheme of a URL, demonstrating the live view concept.

ID: 1270

				
					using uCalcSoftware;

var uc = new uCalc();
using (var url = new uCalc.String("http://example.com")) {
   Console.WriteLine($"Original URL: {url}");
   // Get a view of the scheme part
   var schemeView = url.Before("://");
   // Modify the view
   schemeView.Replace("http", "https");
   // The original string is updated
   Console.WriteLine($"Modified URL: {url}");
}
				
			
Original URL: http://example.com
Modified URL: https://example.com
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   {
      uCalc::String url("http://example.com");
      url.Owned(); // Causes url to be released when it goes out of scope
      cout << "Original URL: " << url << endl;
      // Get a view of the scheme part
      auto schemeView = url.Before("://");
      // Modify the view
      schemeView.Replace("http", "https");
      // The original string is updated
      cout << "Modified URL: " << url << endl;
   }
}
				
			
Original URL: http://example.com
Modified URL: https://example.com
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Using url As New uCalc.String("http://example.com")
         Console.WriteLine($"Original URL: {url}")
         '// Get a view of the scheme part
         Dim schemeView = url.Before("://")
         '// Modify the view
         schemeView.Replace("http", "https")
         '// The original string is updated
         Console.WriteLine($"Modified URL: {url}")
      End Using
   End Sub
End Module
				
			
Original URL: http://example.com
Modified URL: https://example.com