[fpc-announce] Free Pascal Contributed units modified entry. (StrWrap1 (String Functions))

contribs at freepascal.org contribs at freepascal.org
Sat Nov 19 09:16:11 CET 2005


The following entry in the Free Pascal contributed units was modified:

Name         : StrWrap1 (String Functions)
Author       : Lars aka L505
Email        : fpcunits1(at)z505(dot)com
Homepage     : http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=StrWrap1
FTP site     : http://z505.com/download/pascal/StrWrap1/StrWrap1_v1.0E.zip
Version      : 1.0E
Date         : 2005-11-19
Category     : File Handling
Supported OS : Linux, Windows, other
Description  :
Some string and array functions to make getting data out of a text files easy, without using stringlists. Sometimes you find a StringList <b>overkill</b>, when all you need is some simple but powerful string or array operations. 
<p>
This unit is essentially a wrapper for readln, assign, reset (that annoying low level code).
<pre>
 -GetFileSize <i>text or binary file</i>
 -GetLineCount
 -StrLoadFile <i>get entire file into a string var</i>
 -GetLn1, GetLnN  <i>get specific line from text file</i>
 -ArrayLoadFile  <i>get entire file into string array</i>
 -ArrayLoadLines  <i>get only the first N lines of a file into string array</i>
 -StrLoadLines  <i>get only the first N lines of a file into a string</i>
 -StrLoadRng  <i>load range of lines into a string</i>
 -ArrayLoadRng  <i>load range of lines into an array</i>
 -Additionally, some [0] based array functions instead of [1] based. 
 -MyFile.Lines
 -MyFile.Count <i>without ever using a stringlist.</i>
</pre>
You do not need to include the hefty 'classes' unit when using these functions alone. Plus, the entire file is not loaded into the memory with these functions - only the precise lines that you want. Whereas a stringlist loads the entire file into memory no matter what.
<p>
Useful in many situations, such as when you have simple config files. Or in CGI programming. Say you only need to grab the first three lines of a file, and the rest is just comments. Why load the comments into the memory too? Why use classes, and the bulky Free and Create in those situations?





More information about the fpc-announce mailing list