A succinct example demonstrating a simple chain of two replacement actions on the root string.
ID: 1260
using uCalcSoftware;
var uc = new uCalc();
using (var s = new uCalc.String("A and C")) {
// Each Replace() call returns the modified string object, allowing the next call.
s.Replace("A", "B").Replace("C", "D");
Console.Write("Result: ");
Console.WriteLine(s);
};
Result: B and D using uCalcSoftware; var uc = new uCalc(); using (var s = new uCalc.String("A and C")) { // Each Replace() call returns the modified string object, allowing the next call. s.Replace("A", "B").Replace("C", "D"); Console.Write("Result: "); Console.WriteLine(s); };
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::String s("A and C");
s.Owned(); // Causes s to be released when it goes out of scope
// Each Replace() call returns the modified string object, allowing the next call.
s.Replace("A", "B").Replace("C", "D");
cout << "Result: ";
cout << s << endl;
};
}
Result: B and D #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::String s("A and C"); s.Owned(); // Causes s to be released when it goes out of scope // Each Replace() call returns the modified string object, allowing the next call. s.Replace("A", "B").Replace("C", "D"); cout << "Result: "; cout << s << endl; }; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using s As New uCalc.String("A and C")
'// Each Replace() call returns the modified string object, allowing the next call.
s.Replace("A", "B").Replace("C", "D")
Console.Write("Result: ")
Console.WriteLine(s)
End Using
End Sub
End Module
Result: B and D Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using s As New uCalc.String("A and C") '// Each Replace() call returns the modified string object, allowing the next call. s.Replace("A", "B").Replace("C", "D") Console.Write("Result: ") Console.WriteLine(s) End Using End Sub End Module