String functions

Top  Previous  Next

 

function StrToInt(Value: string): Integer;

Converts Value that represents an integer (decimal or hex notation) to a number.

 

function IntToStr(Value: Integer): string;

Converts the integer Value to a string.

 

function FloatToStr(Value: float): string;

Converts the floating point Value to a string.

 

function StrToFloat(Value: string): Float;

Converts the string Value to a floating point value.

 

function Copy(Value: string; Index, Count: Integer): string;

Returns a substring of a string.  E.g. Copy('ABCDEF', 1, 3) returns 'ABC'. Copy('ABCDEF', 4, 2) returns 'DE'.

 

function SubStr(Value: string; Index: Integer): string;

Returns a substring of a string starting from Index. E.g. SubStr('ABCDEF', 3) returns 'CDEF'.

 

function LowerCase(Value: string): string;

Converts all characters in Value to lowercase.

 

function UpperCase(Value: string): string;

Converts all characters in Value to uppercase.

 

function LeftStr(Value: string; Length: Integer): string;

Returns the substring of the specified Length that appears at the start of the string Value.  E.g. LeftStr('ABCDEF', 3) returns 'ABC'.

 

function RightStr(Value: string; Length: Integer): string;

Returns the substring of the specified Length that appears at the end of the string Value.  E.g. RightStr('ABCDEF', 3) returns 'DEF'.

 

function Pos(Substring: string; Value: string): Integer;

Returns the index value of the first character of SubString that occurs in the given Value.  E.g. Pos('C', 'ABCDEF') returns 3.

 

function PosEx(SubString, Value: string; Offset: Integer): Integer;

Returns the index value of the first character of Substring that occurs in the given Value starting from the Offset position.  E.g. PosEx('C', 'ABCDEFABCDEF', 6) returns 9.

 

procedure Insert(SubString: string; var Value: string; Index: Integer);

Inserts Substring into Value beginning at the Index point.  E.g.

 

var Value: string = 'ABCFG';

Insert('DE', Value, 4);

 

Value is 'ABCDEFG' after this code is ran.

 

function Trim(Value: string): string;

Trims leading and trailing spaces and control characters from Value.  E.g. Trim('   ABC   ') returns 'ABC'.

 

function TrimLeft(Value: string): string;

Trims leading spaces and control characters from Value.  E.g. TrimLeft('   ABC   ') returns 'ABC   '.

 

function TrimRight(Value: string): string;

Trims trailing spaces and control characters from Value.  E.g. TrimRight('   ABC   ') returns '   ABC'.

 

function SameText(Value1, Value2: string): Boolean;

Compares two strings by ordinal value without case sensitivity.

 

function StringOfChar(Ch: Char; Count: Integer): string;

Returns a string with a specified number of repeating characters.

 

function StringOfString(SubString: string; Count: Integer): string;

Returns a string with a specified number of repeating substring.

 

function StrBeginsWith(Value: string; SubString: string): Boolean;

Checks if Value begins with SubString.

 

function StrEndsWith(Value: string; SubString: string): Boolean;

Checks if Value ends with SubString.

 

function StrAfter(Value: string; Delimiter: string): string;

Returns a substring of Value after the Delimiter.  E.g. StrAfter('ABC=DEF', '=') returns 'DEF'.

 

function StrBefore(Value: string; Delimiter: string): string;

Returns a substring of Value before the Delimiter.  E.g. StrBefore('ABC=DEF', '=') returns 'ABC'.

 

function ReverseString(Value: string): string;

Returns the reverse of a Value.  E.g. ReverseString('ABC') returns 'CBA'.