The WStrings object can be used to store wide strings (Unicode strings) and is used very much like a normal TStringlist. All you have to do is to type "WStrings." and all the functions available are listed in a listbox. They are also listed below.
NOTE! A text string is enclosed by single quotes in a Pascal script, but double quotes in a C++, VB or Java script.
E.g.
HighlightText('Lorem ipsum') in Pascal script
HighlightText("Lorem ipsum") in C++ script.
Name and Value pairs
Strings separated by a "=" can be treated as name and value pairs. The string list have some functions to retrieve names and values from a string.
E.g.
Name 1=Value 1
Name 2=Value 2
Methods
Add
Syntax
Add(const S: String): Integer;
Description
Add a string to the list. The return value is the index position in the list.
AddObject
Syntax
AddObject(const S: String; AObject: TObject): Integer;
Description
Add a string and an object to the list. The return is the index position in the list.
Clear
Syntax
Clear();
Description
Clear the list.
Delete
Syntax
Delete(Index: Integer);
Description
Delete a string at position "Index" in the list.
Find
Syntax
Find(S: String): Integer;
Description
To use this function the list has to be sorted. Use it instead of "IndexOf". With sorted lists this function is much faster.
GetCount
Syntax
GetCount(): Integer;
Description
Get the number of strings in the list.
GetName
Syntax
GetName(const Index: Integer): String;
Description
Get the name part of a name value pair.
GetObject
Syntax
GetObject(const Index: Integer): TObject;
Description
Get an object from the list.
GetValue
Syntax
GetValue(const Index: Integer): String;
Description
Get the value part of a name and value pair.
GetString
Syntax
GetString(const Index: Integer): String;
Description
Retrieve a string from the given position in the list.
IndexOf
Syntax
IndexOf(const S: String): Integer;
Description
Find the index of a given string in the list.
IndexOfObject
Syntax
IndexOfObject(AObject: TObject): Integer;
Description
Find the index of a given object in the list.
Insert
Syntax
Insert(Index: Integer; const S: String);
Description
Insert a string to the list at position "Index".
InsertObject
Syntax
InsertObject(Index: Integer; const S: String; AObject: TObject);
Description
Insert a string and an object to the list at position "Index".
LoadFromFile
Syntax
LoadFromFile(const FileName: String);
Description
Open a text file and load it into the list.
LoadFromStream
Syntax
LoadFromStream(Stream: TStream);
Description
Load a stream into the list.
SaveToFile
Syntax
SaveToFile(const S: String);
Description
Save the list to a text file.
SaveToStream
Syntax
SaveToStream(Stream: TStream);
Description
Save the list to a stream.
SetObject
Syntax
SetObject(const Index: Integer; const AObject: TObject);
Description
Set a new object at the given position.
SetString
Syntax
SetString(const Index: Integer; const S: String);
Description
Set a new string at the given position.
GetText
Syntax
GetText: String;
Description
Retrieve all strings in the list as a single string, separated by carriage returns and line feeds.
SetText
Syntax
SetText(const S: String);
Description
Set the strings in the list by using a string with individual strings, separated by carriage returns and line feeds.
Sort
Syntax
Sort();
Description
Sort the list.
|