Navigation: TextEd > Extension and Scripts >

Functions

 

 

 

 

There is a rich set of standard functions that can be used in a script. The list below display the Pascal declaration of the functions.

 

Ex 1.

 

function Length(s: String): Integer

 

This tells us the function "Length" needs an argument of String type. It returns an integer.

 

String strName = "Hello world!";
int len = Length(strName);


The variable "len" will now hold the value 12. The string is 12 characters long.


 

Ex 2.

 

procedure Inc(var i: Integer; incr: Integer = 1)

 

The function "Inc" will take an integer as an argument.

The first argument is sent by reference. The second argument is optional.

 

int num = 0;
Inc(num);         // Increase num by 1.
Inc(num,4);       // Increase num by 4.

 

num now holds the value 5.


 

Below is the complete list


function IntToStr(i: Integer): String

function FloatToStr(e: Double): String

function DateToStr(e: Double): String

function TimeToStr(e: Double): String

function DateTimeToStr(e: Double): String

function VarToStr(v: Variant): String

function StrToInt(s: String): Integer

function StrToFloat(s: String): Double

function StrToDate(s: String): Double

function StrToTime(s: String): Double

function StrToDateTime(s: String): Double

function Format(Fmt: String; Args: array): String

function FormatFloat(Fmt: String; Value: Double): 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)

procedure Insert(sub: String; var s: String; pos: Integer)

function Uppercase(s: String): String

function Lowercase(s: String): String

function Trim(s: String): String

function NameCase(s: String): String

function CompareText(s1, s2: String): Integer

function Chr(i: Integer): Char

function Ord(ch: Char): Integer

procedure SetLength(var S: String; L: Integer)

function DirectoryExists(filename: String): Boolean

function FileExists(filename: String): Boolean

function FileSize(filename: String): Integer

function Round(e: Double): Integer

function Trunc(e: Double): Integer

function Int(e: Double): Integer

function Frac(X: Double): Double

function Sqrt(e: Double): Double

function Abs(e: Double): Double

function Sin(e: Double): Double

function Cos(e: Double): Double

function ArcTan(X: Double): Double

function Tan(X: Double): Double

function Exp(X: Double): Double

function Ln(X: Double): Double

function Pi: Double

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: Double

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


 


 

 

 

 

 

Copyright © 2024 Rickard Johansson