1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
<head><title>rsm.string</title>
<meta http-equiv="Expires" content="Jan 1 1990 00:00:00 GMT" />
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
<meta name="Copyright" content="R. Scott McIntire 2003 <rscottmcintire@users.sourceforge.net>" />
<meta name="description" content="String Utilities" />
<meta name="author" content="R. Scott McIntire" />
<meta name="keywords" content="string, Lisp" />
<meta name="generator" content="LML2-1.4.1" />
<center><h1>Documentation for package rsm.string</h1></center></head>
<body bgcolor="#C5C5C5"><hr color="lightred" style="height=10" /><p></p>
<table border="10" bordercolor="navyblue" align="center" cellspacing="15"><tr bgcolor="#A5A5A5"><td><h2>Author : R. Scott McIntire</h2>
<h2>Version: 1.1</h2>
<h2>Overview:</h2>
<pre>This package provides string manipulation functions.
<b style="color:darkblue">Export Summary:</b>
<b style="color:darkblue">
contains:</b> Returns all strings in a list that contain any strings in a list of
string fragments. <b style="color:darkblue">
does-not-contain:</b> Returns all strings in a list that DO NOT contain
any strings in a list of string fragments.<b style="color:darkblue">
file->string:</b> Reads a file returning a string of its contents.<b style="color:darkblue">
file->number-list:</b> Returns a list of numbers read from a text file.<b style="color:darkblue">
file->number-table:</b> Returns a list of a list of numbers after reading a file.<b style="color:darkblue">
file->string-list:</b> Returns a list of strings read from a text file.<b style="color:darkblue">
file->string-table:</b> Returns a list of a list of strings after reading a file.<b style="color:darkblue">
fluff-string:</b> Return a new string that wraps a character
around every character in the supplied string.<b style="color:darkblue">
join:</b> Concatenate the strings in a list returning a new string.<b style="color:darkblue">
list->file:</b> Write a list out to a file.<b style="color:darkblue">
number-list->file:</b> Write a list of numbers (one per line) to a file.<b style="color:darkblue">
split:</b> Split a string into a list of strings.<b style="color:darkblue">
string->file:</b> Writes a string to a file.<b style="color:darkblue">
string->number:</b> Convert a string representing a number to a number.</pre>
</td></tr><tr bgcolor="#C5C5C5"></tr><tr bgcolor="#C5C5C5"><td>
<h2 style="color=darkblue">contains<b style="color=blue">  (str-list elem-list &key (contain-meaning #'some))</b></h2><pre>Returns all strings in <em style="color:blue"><str-list></em> that contain strings in <em style="color:blue"><elem-list></em>; where
the meaning of contains is provided in the function <em style="color:blue"><contain-meaning></em>.
<em style="color:blue"><contain-meaning></em> must take a function and a list as an argument.<div style="color:darkgreen">
Example: (rsm.string:contains '("abc" "def" "ghi") '("bc" "gh")) </div>
("abc" "ghi")</pre>
<h2 style="color=darkblue">does-not-contain<b style="color=blue">  (str-list str-elems &key (unique nil))</b></h2><pre>Return a list of strings from the string list, <em style="color:blue"><str-list></em>, that do not
contain any of the strings from the list of strings <em style="color:blue"><str-elems.></em> If unique is
non nil, then the resulting list will remove duplicates. In any event, the
order of the list may change.<div style="color:darkgreen">
Example: (rsm.string:does-not-contain '("abc" "def" "ghi") '("ab" "gh")) </div>
("def")</pre>
<h2 style="color=darkblue">file->number-list<b style="color=blue">  (file-name &key (delims " ") (missing-value-marker nil))</b></h2><pre>Takes a file name and a key word of delimiters and returns a list of
strings that are delimited by any character in <em style="color:blue"><delims></em>. If
<em style="color:blue"><missing-value-marker></em> is non nil, then <em style="color:blue"><missing-value-marker></em> will be used
for missing values.</pre>
<h2 style="color=darkblue">file->number-table<b style="color=blue">  (file-name &key (delims " ") (missing-value-marker nil) (header nil))</b></h2><pre>Takes a file name and a a key word of delimiters and returns a table -
a list of lists of numbers. The rows are the lines of the file; within
each row, the nth column element is the nth (non-null) number. If
<em style="color:blue"><missing-value-marker></em> is non nil, then <em style="color:blue"><missing-value-marker></em> will be used
for missing values. If <em style="color:blue"><header></em> is non-nil and a number, the first <em style="color:blue"><header></em>
lines will be discarded. Otherwise, if <em style="color:blue"><header></em> is non-nil, then the first
line will be discarded.</pre>
<h2 style="color=darkblue">file->string<b style="color=blue">  (file-name)</b></h2><pre>Reads file <em style="color:blue"><file-name></em> returning a string of its contents.</pre>
<h2 style="color=darkblue">file->string-list<b style="color=blue">  (file-name &key (delims " ") (missing-value-marker nil))</b></h2><pre>Takes a file name and a key word of delimiters and returns a list of
strings that are delimited by any character in <em style="color:blue"><delims></em>. If
<em style="color:blue"><missing-value-marker></em> is non nil, then <em style="color:blue"><missing-value-marker></em>
will be used for missing values.</pre>
<h2 style="color=darkblue">file->string-table<b style="color=blue">  (file-name &key (delims " ") (missing-value-marker nil) (header nil))</b></h2><pre>Takes a file name and a key word of delimiters and returns a table -
a list of lists of strings. The rows are the lines of the file; within
each row, the nth column element is the the nth (non-null) delimited string.
If <em style="color:blue"><missing-value-marker></em> is non nil, then <em style="color:blue"><missing-value-marker></em> will be used
for missing values. If <em style="color:blue"><header></em> is non-nil and a number, the first <em style="color:blue"><header></em>
lines will be discarded. Otherwise, if <em style="color:blue"><header></em> is non-nil, then the first
line will be discarded.</pre>
<h2 style="color=darkblue">fluff-string<b style="color=blue">  (str about-string &key (fluff-char #\Space))</b></h2><pre>Return a new string that wraps the character <em style="color:blue"><fluff-char></em> around every
character in the string <em style="color:blue"><about-string></em>.<div style="color:darkgreen">
Example: (rsm.string:fluff-string "123+345+567" "+" :fluff-string #Space ) </div>
"123 + 345 + 567"</pre>
<h2 style="color=darkblue">join<b style="color=blue">  (str-list &key (join-string nil))</b></h2><pre>Returns a new string formed by joining all the strings in <em style="color:blue"><str-list></em>.
If <em style="color:blue"><join-string></em> is non-nil, it is used as a joining string between
elements of the list.<div style="color:darkgreen">
Example: (rsm.string:join '("abc" "def" "ghi") :join-string "_") </div>
"abc_def_ghi"</pre>
<h2 style="color=darkblue">list->file<b style="color=blue">  (list file-name)</b></h2><pre>Write out a list to a file. As the list structure is intact, the list can be
read back in with a single call to the reader.</pre>
<h2 style="color=darkblue">number-list->file<b style="color=blue">  (num-list file-name)</b></h2><pre>Writes a list of numbers out to a file with one line for each number.</pre>
<h2 style="color=darkblue">split<b style="color=blue">  (str &key (delims " ") (reverse nil) (missing-value-marker nil))</b></h2><pre>Returns a list of strings formed by splitting <em style="color:blue"><str></em> at any character
contained in <em style="color:blue"><delims></em>. If <em style="color:blue"><missing-value-marker></em> is non-nil, then
<em style="color:blue"><missing-value-marker></em> is used when no text is found between delimiters.<div style="color:darkgreen">
Example: (rsm.string:split "abc def ghi" :delims " ") </div>
("abc" "def" "ghi")</pre>
<h2 style="color=darkblue">string->file<b style="color=blue">  (string file-name)</b></h2><pre>Writes the string, <em style="color:blue"><string></em>, out to the file, <em style="color:blue"><file-name></em>. If the
file exists it will be replaced.</pre>
<h2 style="color=darkblue">string->number<b style="color=blue">  (str)</b></h2><pre>Convert a string <em style="color:blue"><str></em> representing a number to a number. A second value is
returned indicating the success of the conversion.<div style="color:darkgreen">
Example: (rsm.string:string->number "123") </div>
123
t</pre></td></tr></table></body>
|