initial commit
[rofl0r-KOL.git] / main_tstrlist.htm
blob64da9f9aaee3e96070591d6025f359c9f804c62b
1 <html>
2 <head>
3 <title>KOL Help: TStrList object (main frame)</title>
4 <base target="_top">
5 </head>
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>
11 </b></font></p>
12 <p><b>
13 TStrList = object( <a href=tobj.htm target="_top">TObj</a> )
14 </b></p>
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
18 of text data).
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>
23 <a name="values"></a>
24 <p>
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>
26 <br>
27 by Dod. Returns right side of a line starting like Name=...
28 </p>
29 <a name="count"></a>
30 <p>
31 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Count</b></font>: <b>integer</b>;</font>
32 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#209;</font>&nbsp;&nbsp;&nbsp;
33 <br>
34 Number of strings in a string list.
35 </p>
36 <a name="items"></a>
37 <p>
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>
39 <br>
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.
42 </p>
43 <a name="itemptrs"></a>
44 <p>
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 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#209;</font>&nbsp;&nbsp;&nbsp;
47 <br>
48 Fast access to item strings as PChars.
49 </p>
50 <a name="text"></a>
51 <p>
52 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Text</b></font>: <b>string</b>;</font>
53 <br>
54 Content of string list as a single string (where strings are separated
55 by characters $0D,$0A).
56 </p>
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>
60 <p>
61 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>IndexOfName</b></font>( Name: <b>string</b> ): <b>Integer</b>;</font>
62 <br>
63 by Dod. Returns index of line starting like Name=...
64 </p>
65 <a name="add"></a>
66 <p>
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>
68 <br>
69 Adds a string to list.
70 </p>
71 <a name="addstrings"></a>
72 <p>
73 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>AddStrings</b></font>( Strings: PStrList );</font>
74 <br>
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.
77 </p>
78 <a name="assign"></a>
79 <p>
80 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Assign</b></font>( Strings: PStrList );</font>
81 <br>
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.
84 </p>
85 <a name="clear"></a>
86 <p>
87 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Clear</b></font>;</font>
88 <br>
89 Makes string list empty.
90 </p>
91 <a name="delete"></a>
92 <p>
93 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Delete</b></font>( Idx: <b>integer</b> );</font>
94 <br>
95 Deletes string with given index (it *must* exist).
96 </p>
97 <a name="indexof"></a>
98 <p>
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>
100 <br>
101 Returns index of first string, equal to given one.
102 </p>
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>
106 <br>
107 Returns index of first string, equal to given one (while comparing it
108 without case sensitivity).
109 </p>
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>
113 <br>
114 Returns index of first string, equal to given one (while comparing it
115 without case sensitivity).
116 </p>
117 <a name="find"></a>
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>
120 <br>
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.
125 </p>
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>
129 <br>
130 Inserts string before one with given index.
131 </p>
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>
135 <br>
136 Loads string list from a file. (If file does not exist, nothing
137 happens). Very fast even for huge text files.
138 </p>
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>
142 <br>
143 Loads string list from a stream (from current position to the end of
144 a stream). Very fast even for huge text.
145 </p>
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>
149 <br>
150 Merges string list with strings in a file. Fast.
151 </p>
152 <a name="move"></a>
154 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Move</b></font>( CurIndex, NewIndex: <b>integer</b> );</font>
155 <br>
156 Moves string to another location.
157 </p>
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>
161 <br>
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>).
167 </p>
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>
171 <br>
172 Allows to assign UNIX-style text (with #10 as string separator).
173 </p>
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>
177 <br>
178 Stores string list to a file.
179 </p>
180 <a name="savetostream"></a>
182 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>SaveToStream</b></font>( Stream: PStream );</font>
183 <br>
184 Saves string list to a stream (from current position).
185 </p>
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>
189 <br>
190 Appends strings of string list to the end of a file.
191 </p>
192 <a name="last"></a>
194 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>Last</b></font>: <b>String</b>;</font>
195 <br>
196 Last item (or '', if string list is empty).
197 </p>
198 <a name="swap"></a>
200 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Swap</b></font>( Idx1, Idx2: <b>Integer</b> );</font>
201 <br>
202 Swaps to strings with given indeces.
203 </p>
204 <a name="sort"></a>
206 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Sort</b></font>( CaseSensitive: <b>Boolean</b> );</font>
207 <br>
208 Call it to sort string list.
209 </p>
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>
213 <br>
214 Call it to sort ANSI string list.
215 </p>
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>
221 <hr>
222 <p align="center">[&nbsp;<a href=index.htm>Index</a>&nbsp;]</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>
224 </body>
225 </html>