A simple find-and-replace operation using the fluent, chainable API.
ID: 1257
using uCalcSoftware;
var uc = new uCalc();
using (var s = new uCalc.String("The quick brown fox.")) {
// Replace returns the modified String object, but also modifies it in-place
s.Replace("brown", "red");
// Use implicit conversion to print the result
Console.WriteLine(s);
};
The quick red fox. using uCalcSoftware; var uc = new uCalc(); using (var s = new uCalc.String("The quick brown fox.")) { // Replace returns the modified String object, but also modifies it in-place s.Replace("brown", "red"); // Use implicit conversion to print the result Console.WriteLine(s); };
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::String s("The quick brown fox.");
s.Owned(); // Causes s to be released when it goes out of scope
// Replace returns the modified String object, but also modifies it in-place
s.Replace("brown", "red");
// Use implicit conversion to print the result
cout << s << endl;
};
}
The quick red fox. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::String s("The quick brown fox."); s.Owned(); // Causes s to be released when it goes out of scope // Replace returns the modified String object, but also modifies it in-place s.Replace("brown", "red"); // Use implicit conversion to print the 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("The quick brown fox.")
'// Replace returns the modified String object, but also modifies it in-place
s.Replace("brown", "red")
'// Use implicit conversion to print the result
Console.WriteLine(s)
End Using
End Sub
End Module
The quick red fox. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using s As New uCalc.String("The quick brown fox.") '// Replace returns the modified String object, but also modifies it in-place s.Replace("brown", "red") '// Use implicit conversion to print the result Console.WriteLine(s) End Using End Sub End Module