9. Built in parsing functions
function Pos(Substr : WideString; Str: WideString): IntegerReturns the index value of the first character in a specified substring that occurs in a given string.
function PosFrom(const SubStr, Str : WideString; FromIndex : Integer) : IntegerReturns the index value of the first character in a specified substring that occurs in a given string. Search starts from
FromIndex[/b]
function LastPos(const SubStr, Str : WideString) : IntegerReturns the
last index value of the first character in a specified substring that occurs in a given string.
function PrevPos(const SubStr, Str : WideString; APos : Integer) : IntegerReturns the index value of the first character in a specified substring that occurs in a given string before
APos.
function RemoveTags(AText : WideString; doLineBreaks : Boolean) : WideStringRemoves all HTML tags from
AText. Ex.:
<a href="http://test.com">Test</a> will be converted to
Test. If doLineBreaks is set to True, then <br> will be converted to a line break.
function ExplodeString(AText : WideString; var Items : TWideArray; Delimiters : WideString) : IntegerSplits a string
AText into separate values using
Delimiters. The values are written into a dynamic array
Items.
function Copy(S: WideString; Index, Count: Integer): WideStringReturns a substring of a string.
procedure Delete(var S: WideString; Index, Count: Integer)Removes a substring from a string.
procedure Insert(Source: WideString; var Dest: WideString; Index: Integer)Inserts a substring into a string beginning at a specified point.
function Length(S: WideString): IntegerReturns the number of characters in a string.
function Trim(S: WideString): WideStringTrims leading and trailing spaces and control characters from a string.
function CompareText(S1, S2: WideString): IntegerCompares two strings by ordinal value without case sensitivity.
The function returns
0 if both strings are equal, a value
> 0 if
S1 >
S2 and a value
< 0 if
S1 <
S2.
function CompareStr(S1, S2: WideString): IntegerCompares two strings by ordinal value
with case sensitivity.
The function returns
0 if both strings are equal, a value
> 0 if
S1 >
S2 and a value
< 0 if
S1 <
S2.
function UpperCase(S: WideString): WideStringReturns a copy of a string in uppercase.
function LowerCase(S: WideString): WideStringReturns a copy of a string in lowercase.
function StringReplace(S, OldPattern, NewPattern: WideString; ReplaceAll : Boolean; IgnoreCase : Boolean; WholeWord: Boolean): WideString Returns a string with occurrences of one substring replaced by another substring. If
ReplaceAll is set to
True, the all occurrences of
OldPattern will be replaced. If
IgnoreCase is set to
True, then the comparison operation is case insensitive.
function StrToInt(const S: WideString): IntegerConverts a string that represents an integer (decimal or hex notation) to a number.
function IntToStr(const Value: Integer): WideStringConverts an integer number to a string.
function StrToFloat(const S: WideString): ExtendedConverts a given string to a floating-point value.
function FloatToStr(const Value: Extended): WideStringConverts a floating point value to a string.
function HTMLValues(const HTML : WideString; ABegin, AEnd, ItemBegin, ItemEnd : WideString; ValDelim : WideString; var Pos : Integer) : WideStringGathers all values from HTML into a string using
ValDelim as delimiter. The function searches for
ABegin first starting from
Pos, from this point it gathers values between
ItemBegin and
ItemEnd until
AEnd is found. The last position is returned in
Pos variable.
function HTMLValues2(const HTML : WideString; ABegin, AEnd, ItemBegin, ItemEnd : WideString; ValDelim : WideString; var Pos : Integer) : WideStringThe same as HTMLValues, but this version searches for an end tag character
> after each
ItemBegin.
function TextBetween(const HTML : WideString; ABegin, AEnd : WideString; doLineBreaks : Boolean; var Pos : Integer) : WideStringReturns plain text
without HTML tags from
HTML, between
ABegin and
AEnd. The function searches for
ABegin from position
Pos.
function HTMLToText(const HTML : WideString) : WideStringReplaces all escaped HTML characters (like <>&") with normal characters (like <, >, $, ")