Replace(Str: String; SubStr: String; Replacement: String): String;
Replace(Str: string; SubStr: string; Replacement: string): String;
Str. Source string.
SubStr. Substring that must be replaced.
Replacement. Substring, with which the specified string must be replaced.
The Replace method returns a string, in which all occurrences of the specified substring are replaced with the specified string.
If the substring is not found, the source string is not changed.
The method is case-sensitive.
To execute the example, add a link to the Ms system assembly.
Sub UserProc;
Var
Func: Modelling;
res: String;
Begin
Func := New Modelling.Create;
res := Func.Replace("Version 8.5", "8.5", "9.0");
Debug.WriteLine("Replace(""" + "Version 8.5" + """" + ",""" +
"8.5" + """" + ", """ + "9.0" + """" + ") = " + res);
End Sub UserProc;
After executing the example the console window displays a string obtained after replacing the 8.5 substring with the 9.0 substring in the Version 8.5 source string.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
Func: IModelling;
res: String;
Begin
Func := New Modelling.Create();
res := Func.Replace("Version 8.5", "8.5", "9.0");
System.Diagnostics.Debug.WriteLine("Replace(""" + "Version 8.5" + """" +
",""" + "8.5" + """" + ", """ + "9.0" + """" + ") = " + res);
End Sub;
Expression:
Replace("Version 8.5", "8.5", "9.0")
Result: Version 9.0.
Expression 2:
Replace("Version 8.5", "version", "Edition")
Result: Version 8.5.
Use: expressions can be used in model formulas of modeling container, in formulas of time series database calculated series, in formulas of the modeling container that is a child one for time series database in formula editor.
See also:
IModelling | Time Series Database: Calculator| Modeling Container: Editing Regressor or Formula | Expression Editor
See also: