Search Results for

    Show / Hide Table of Contents

    Функции

    В скрипте можно использовать богатейший набор стандартных функций. To get an access to these functions, pass the fsGlobalUnit reference to the TfsScript.Parent property.

    function IntToStr(i: Integer): String
    function FloatToStr(e: Extended): String
    function DateToStr(e: Extended): String
    function TimeToStr(e: Extended): String
    function DateTimeToStr(e: Extended): String
    function VarToStr(v: Variant): String
    
    function StrToInt(s: String): Integer
    function StrToFloat(s: String): Extended
    function StrToDate(s: String): Extended
    function StrToTime(s: String): Extended
    function StrToDateTime(s: String): Extended
    
    function Format(Fmt: String; Args: array): String
    function FormatFloat(Fmt: String; Value: Extended): String
    function FormatDateTime(Fmt: String; DateTime: TDateTime): String
    function FormatMaskText(EditMask: string; Value: string): string
    
    function EncodeDate(Year, Month, Day: Word): TDateTime
    procedure DecodeDate(Date: TDateTime; var Year, Month, Day: Word)
    function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime
    procedure DecodeTime(Time: TDateTime; var Hour, Min, Sec, MSec: Word)
    function Date: TDateTime
    function Time: TDateTime
    function Now: TDateTime
    function DayOfWeek(aDate: DateTime): Integer
    function IsLeapYear(Year: Word): Boolean
    function DaysInMonth(nYear, nMonth: Integer): Integer
    
    function Length(s: String): Integer
    function Copy(s: String; from, count: Integer): String
    function Pos(substr, s: String): Integer
    procedure Delete(var s: String; from, count: Integer): String
    procedure Insert(s: String; var s2: String; pos: Integer): String
    function Uppercase(s: String): String
    function Lowercase(s: String): String
    function Trim(s: String): String
    function NameCase(s: String): String
    function CompareText(s, s1: String): Integer
    function Chr(i: Integer): Char
    function Ord(ch: Char): Integer
    procedure SetLength(var S: String; L: Integer)
    
    function Round(e: Extended): Integer
    function Trunc(e: Extended): Integer
    function Int(e: Extended): Integer
    function Frac(X: Extended): Extended
    function Sqrt(e: Extended): Extended
    function Abs(e: Extended): Extended
    function Sin(e: Extended): Extended
    function Cos(e: Extended): Extended
    function ArcTan(X: Extended): Extended
    function Tan(X: Extended): Extended
    function Exp(X: Extended): Extended
    function Ln(X: Extended): Extended
    function Pi: Extended
    
    procedure Inc(var i: Integer; incr: Integer = 1)
    procedure Dec(var i: Integer; decr: Integer = 1)
    procedure RaiseException(Param: String)
    procedure ShowMessage(Msg: Variant)
    procedure Randomize
    function Random: Extended
    function ValidInt(cInt: String): Boolean
    function ValidFloat(cFlt: String): Boolean
    function ValidDate(cDate: String): Boolean
    function CreateOleObject(ClassName: String): Variant
    function VarArrayCreate(Bounds: Array; Typ: Integer): Variant
    

    Как видите, некоторые функции и процедуры содержат параметры по умолчанию. Вы можете вызывать их так же, как и в Delphi:

    Inc(a);
    Inc(b, 2);
    

    Вы можете подключить свои собственные процедуры и функции к скрипту - подробнее смотрите главу "создание скриптов".

    Back to top © ООО «Быстрые отчеты»