IModelling.Mid

Fore Syntax

Mid(Str: String; Start: Integer; [Length: Integer = 0]): String;

Fore.NET Syntax

Mid(Str: string; Start: integer; Length: integer = 0): string;

Parameters

Str. Source string.

Start. Position in the source string, from which the returned substring must start.

Length. The number of characters in the returned string.

Description

The Mid method returns a substring of the specified length that starts with the specified position of source string.

Comments

Character numbering in the string starts with 1.

If the Length parameter is set to 0, the returned substring contains all characters in the specified position and to the end of the source string.

Fore Example

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.Mid("Calculator"24);
    Debug.WriteLine("Mid(""" + "Calculator" + """" + ", 2, 4) = " + res);
End Sub UserProc;

After executing the example the console window displays four characters of the Calculator string starting with the second character.

Fore.NET Example

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.Mid("Calculator"24);
    System.Diagnostics.Debug.WriteLine("Mid(""" + "Calculator" + """" + ", 2, 4) = " + res);
End Sub;

Example of Use in Expressions

Expression:

Mid("Calculator", 3)

Result: lculator.

Expression 2:

Mid("Calculator", 2, 4)

Result: acul.

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:

IModelling