3 <title>KOL Help: TStrList object (main frame)
</title>
7 <body bgcolor=
"#FFFFEF" text=
"#000000" link=
"#008080" vlink=
"#008000" alink=
"#808000">
8 <p><font face=
"Courier" color=
"#800080"><b>TStrList( unit
<a href=kol_pas.htm
>KOL.pas
</a> )
9 <font face=
"Wingdings">ï
</font> <a href=tobj.htm
>TObj
</a>
10 <font face=
"Wingdings">ï
</font> <a href=_tobj.htm
>_TObj
</a>
13 TStrList = object(
<a href=tobj.htm
target=
"_top">TObj
</a> )
15 Easy string list implementation (non-visual, just to store
16 string data). It is well improved and has very high performance
17 allowing to work fast with huge text files (more then megabyte
19 Please note that #
0 charaster if stored in string lines, will cut it
20 preventing reading the rest of a line. Be careful, if your data
21 contain such characters.
22 <h3 align=
"center"><font color=
"#FF8080">TStrList properties
</font></h3>
25 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Values
</b></font>[
<b>const
</b> Name:
<b>string
</b> ]:
<b>string
</b>;
</font>
27 by Dod. Returns right side of a line starting like Name=...
31 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Count
</b></font>:
<b>integer
</b>;
</font>
32 <font face=
"Webdings" size=
7>Ñ</font>
34 Number of strings in a string list.
38 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Items
</b></font>[ Idx:
<b>integer
</b> ]:
<b>string
</b>;
<b>default
</b>;
</font>
40 Strings array items. If item does not exist, empty string is returned.
41 But for assign to property, string with given index *must* exist.
43 <a name=
"itemptrs"></a>
45 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>ItemPtrs
</b></font>[ Idx:
<b>Integer
</b> ]:
<b>PChar
</b>;
</font>
46 <font face=
"Webdings" size=
7>Ñ</font>
48 Fast access to item strings as PChars.
52 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Text
</b></font>:
<b>string
</b>;
</font>
54 Content of string list as a single string (where strings are separated
55 by characters $
0D,$
0A).
57 <h4 align=
"center"><font color=
"black">Properties, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
58 <h3 align=
"center"><font color=
"#FF8080">TStrList methods
</font></h3>
59 <a name=
"indexofname"></a>
61 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>IndexOfName
</b></font>( Name:
<b>string
</b> ):
<b>Integer
</b>;
</font>
63 by Dod. Returns index of line starting like Name=...
67 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>Add
</b></font>(
<b>const
</b> S:
<b>string
</b> ):
<b>integer
</b>;
</font>
69 Adds a string to list.
71 <a name=
"addstrings"></a>
73 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>AddStrings
</b></font>( Strings: PStrList );
</font>
75 Merges string list with given one. Very fast - more preferrable to
76 use than any loop with calling
<a href=#add
target=
"main">Add
</a> method.
80 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Assign
</b></font>( Strings: PStrList );
</font>
82 Fills string list with strings from other one. The same as
<a href=#addstrings
target=
"main">AddStrings
</a>,
83 but
<a href=#clear
target=
"main">Clear
</a> is called first.
87 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Clear
</b></font>;
</font>
89 Makes string list empty.
93 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Delete
</b></font>( Idx:
<b>integer
</b> );
</font>
95 Deletes string with given index (it *must* exist).
97 <a name=
"indexof"></a>
99 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>IndexOf
</b></font>(
<b>const
</b> S:
<b>string
</b> ):
<b>integer
</b>;
</font>
101 Returns index of first string, equal to given one.
103 <a name=
"indexof_nocase"></a>
105 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>IndexOf_NoCase
</b></font>(
<b>const
</b> S:
<b>string
</b> ):
<b>integer
</b>;
</font>
107 Returns index of first string, equal to given one (while comparing it
108 without case sensitivity).
110 <a name=
"indexofstrl_nocase"></a>
112 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>IndexOfStrL_NoCase
</b></font>( Str:
<b>PChar
</b>; L:
<b>Integer
</b> ):
<b>integer
</b>;
</font>
114 Returns index of first string, equal to given one (while comparing it
115 without case sensitivity).
119 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>Find
</b></font>(
<b>const
</b> S:
<b>String
</b>;
<b>var
</b> Index:
<b>Integer
</b> ):
<b>Boolean
</b>;
</font>
121 Returns Index of the first string, equal or greater to given pattern, but
122 works only for sorted TStrList object. Returns TRUE if exact string found,
123 otherwise nearest (greater then a pattern) string index is returned,
124 and the result is FALSE.
126 <a name=
"insert"></a>
128 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Insert
</b></font>( Idx:
<b>integer
</b>;
<b>const
</b> S:
<b>string
</b> );
</font>
130 Inserts string before one with given index.
132 <a name=
"loadfromfile"></a>
134 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>LoadFromFile
</b></font>(
<b>const
</b> FileName:
<b>string
</b> ):
<b>Boolean
</b>;
</font>
136 Loads string list from a file. (If file does not exist, nothing
137 happens). Very fast even for huge text files.
139 <a name=
"loadfromstream"></a>
141 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>LoadFromStream
</b></font>( Stream: PStream; Append2List:
<b>boolean
</b> );
</font>
143 Loads string list from a stream (from current position to the end of
144 a stream). Very fast even for huge text.
146 <a name=
"mergefromfile"></a>
148 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>MergeFromFile
</b></font>(
<b>const
</b> FileName:
<b>string
</b> );
</font>
150 Merges string list with strings in a file. Fast.
154 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Move
</b></font>( CurIndex, NewIndex:
<b>integer
</b> );
</font>
156 Moves string to another location.
158 <a name=
"settext"></a>
160 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>SetText
</b></font>(
<b>const
</b> S:
<b>string
</b>; Append2List:
<b>boolean
</b> );
</font>
162 Allows to set strings of string list from given string (in which
163 strings are separated by $
0D,$
0A or $
0D characters).
<a href=#text
target=
"main">Text
</a> must not
164 contain #
0 characters. Works very fast. This method is used in
165 all others, working with text arrays (
<a href=#loadfromfile
target=
"main">LoadFromFile
</a>,
<a href=#mergefromfile
target=
"main">MergeFromFile
</a>,
166 <a href=#assign
target=
"main">Assign
</a>,
<a href=#addstrings
target=
"main">AddStrings
</a>).
168 <a name=
"setunixtext"></a>
170 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>SetUnixText
</b></font>(
<b>const
</b> S:
<b>String
</b>; Append2List:
<b>Boolean
</b> );
</font>
172 Allows to assign UNIX-style text (with #
10 as string separator).
174 <a name=
"savetofile"></a>
176 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>SaveToFile
</b></font>(
<b>const
</b> FileName:
<b>string
</b> ):
<b>Boolean
</b>;
</font>
178 Stores string list to a file.
180 <a name=
"savetostream"></a>
182 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>SaveToStream
</b></font>( Stream: PStream );
</font>
184 Saves string list to a stream (from current position).
186 <a name=
"appendtofile"></a>
188 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>AppendToFile
</b></font>(
<b>const
</b> FileName:
<b>string
</b> ):
<b>Boolean
</b>;
</font>
190 Appends strings of string list to the end of a file.
194 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>Last
</b></font>:
<b>String
</b>;
</font>
196 Last item (or '', if string list is empty).
200 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Swap
</b></font>( Idx1, Idx2:
<b>Integer
</b> );
</font>
202 Swaps to strings with given indeces.
206 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Sort
</b></font>( CaseSensitive:
<b>Boolean
</b> );
</font>
208 Call it to sort string list.
210 <a name=
"ansisort"></a>
212 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>AnsiSort
</b></font>( CaseSensitive:
<b>Boolean
</b> );
</font>
214 Call it to sort ANSI string list.
216 <h4 align=
"center"><font color=
"black">Methods, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
217 <h3 align=
"center"><font color=
"#FF8080">TStrList events
</font></h3>
218 <h4 align=
"center"><font color=
"black">Events, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
219 <h3 align=
"center"><font color=
"#FF8080">TStrList fields
</font></h3>
220 <h4 align=
"center"><font color=
"black">Fields, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
222 <p align=
"center">[
<a href=index.htm
>Index
</a> ]
</p>
223 <p align=
"center"><font face=
"Comic Sans MS"><small>This help is generated
22-Sep-
2005 by KOL Help generator, (C)
2000-
2001 by Vladimir Kladov
<br>Modified (C)
2003 by Alexander Bartov
</small></font></p>