DWStrList
Members (14)
Documentation
DWStrList
DWStrListimplements an indexed doubly-linked list for the DWSTRING (Unicode dynamic string) data type.
Include file : DWStrProcs.inc
Usage examples
Using the dotted syntax:
' // Build the linked list
DIM List AS DWStrList
List.Add("Result 1")
List.Add("Result 2")
List.Add("Result 3")
List.Insert(1, "New string")
List.Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List.Count
PRINT List.Item(i)
NEXT
Using NEW and the pointer syntax:
' // Build the linked list
DIM List AS DWStrList PTR = NEW DWStrList
List->Add("Result 1")
List->Add("Result 2")
List->Add("Result 3")
List->Insert(1, "New string")
List->Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List->Count
PRINT List->Item(i)
NEXT
' // Delete the list
Delete List
Methods
| Name | Description |
|---|---|
| Add | Appends an item to the list. |
| Clear | Empties the entire list. |
| Count | Returns the number of items in the list. |
| Insert | Inserts an item at the specific index. |
| Item | Retrieves the item at the specified index. |
| Remove | Removes the specified item from the list. |
| Replace | Replaces the item at the specified index. |
DVarList
DVarListimplements an indexed doubly-linked list for the DVARIANT (dynamic variant) data type. A DVARIANT can contain any kind of data except fixed-length string data (if you pass it as the input it will be converted to a unicode dynamic string).
Include file : DVariant.inc
Usage examples
Using the dotted syntax:
' // Build the linked list
DIM List AS DVarList
List.Add("Result 1")
List.Add("Result 2")
List.Add("Result 3")
List.Insert(1, "New string")
List.Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List.Count
PRINT List.Item(i)
NEXT
Using NEW and the pointer syntax:
' // Build the linked list
DIM List AS DVarList PTR = NEW DVarList
List->Add("Result 1")
List->Add("Result 2")
List->Add("Result 3")
List->Insert(1, "New string")
List->Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List->Count
PRINT List->Item(i)
NEXT
' // Delete the list
Delete List
Methods
| Name | Description |
|---|---|
| Add | Appends an item to the list. |
| Clear | Empties the entire list. |
| Count | Returns the number of items in the list. |
| Insert | Inserts an item at the specific index. |
| Item | Retrieves the item at the specified index. |
| Remove | Removes the specified item from the list. |
| Replace | Replaces the item at the specified index. |
Add (DWStrList)
Appends a string to the list.
FUNCTION Add (BYREF dws AS DWSTRING) AS LONG
| Parameter | Description |
|---|---|
| dws | The string to append. |
Return value
Returns the number of items in the list.
Clear (DWStrList)
Empties the entire list.
SUB Clear
Count (DWStrList)
Returns the number of items in the list.
FUNCTION Count () AS LONG
Return value
Returns the number of items in the list.
Insert (DWStrList)
Inserts an item at the specific index.
FUNCTION Insert (BYVAL idx AS LONG, BYREF dws AS DWSTRING) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index where to insert the item. |
| dws | The string to insert. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Item (DWStrList)
Retrieves the item at the specified index.
FUNCTION Item (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to retrieve. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Remove (DWStrList)
Removes the specified item from the list. Indexes are one-based.
FUNCTION Remove (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to remove. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Replace (DWStrList)
Replaces the item at the specified index.
FUNCTION Replace (BYVAL idx AS LONG, BYREF dws AS DWSTRING) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to replace. |
| dws | The replacement string. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Add (DVarList)
Appends a VARIANT to the list.
FUNCTION Add (BYREF dv AS DVARIANT) AS LONG
| Parameter | Description |
|---|---|
| dv | The VARIANT to append. |
Return value
Returns the number of items in the list.
Clear (DVarList)
Empties the entire list.
SUB Clear
Count (DVarList)
Returns the number of items in the list.
FUNCTION Count () AS LONG
Return value
Returns the number of items in the list.
Insert (DVarList)
Inserts an item at the specific index.
FUNCTION Insert (BYVAL idx AS LONG, BYREF dv AS DVARIANT) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index where to insert the item. |
| dv | The variant to insert. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Item (DVarList)
Retrieves the item at the specified index.
FUNCTION Item (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to retrieve. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Remove (DVarList)
Removes the specified item from the list. Indexes are one-based.
FUNCTION Remove (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to remove. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.
Replace (DVarList)
Replaces the item at the specified index.
FUNCTION Replace (BYVAL idx AS LONG, BYREF dv AS DVARIANT) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to replace. |
| dv | The replacement variant. |
Return value
If the method succeeds, it returns TRUE; otherwise, FALSE.