Subset (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%"><b>Create Stringlist that is subset of input Stringlist</b></span>
{{Template:Stringlist:Subset subtitle}}


Subset is a member of the [[Stringlist class]].
Subset is a member of the [[Stringlist class]].
Line 5: Line 5:
This method creates a Stringlist that is a subset of the method Stringlist. The subset is created by selecting all entries that contain a specified search string.
This method creates a Stringlist that is a subset of the method Stringlist. The subset is created by selecting all entries that contain a specified search string.


==Subset Syntax==
==Syntax==
<pre>
{{Template:Stringlist:Subset syntax}}
%outlist = %sl:Subset(string, [startcol], [endcol], -
===Syntax terms===
[caseflag])
</pre>
 
===Syntax Terms===
<dl>
<dl>
<dt>%outlist<dd>A reference to a Stringlist which is set to the newly-created subset Stringlist.<dt>%sl<dd>A Stringlist object.<dt>string<dd>The string to be located. This argument is called the search string.<dt>startcol<dd>The starting column number of the range of columns in which the search string must be located. This is an optional argument, and it defaults to 1.<dt>endcol<dd>The ending column number of the range of columns in which the search string must be located. This is an optional argument which defaults to 6124. If '''endcol''' is a non-zero integer, the width of the column range is reduced to a maximum of 256.<dt>caseflag<dd>An indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use the Stringlist item data translated to uppercase (so the search string should be passed as an uppercase value). This is an optional argument, and it defaults to zero. If this argument is non-zero, the width of the column range specified by the second and third argument values is reduced to a maximum of 256. </dl>
<dt>%outlist<dd>A reference to a Stringlist which is set to the newly-created subset Stringlist.<dt>%sl<dd>A Stringlist object.<dt>string<dd>The string to be located. This argument is called the search string.<dt>startcol<dd>The starting column number of the range of columns in which the search string must be located. This is an optional argument, and it defaults to 1.<dt>endcol<dd>The ending column number of the range of columns in which the search string must be located. This is an optional argument which defaults to 6124. If '''endcol''' is a non-zero integer, the width of the column range is reduced to a maximum of 256.<dt>caseflag<dd>An indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use the Stringlist item data translated to uppercase (so the search string should be passed as an uppercase value). This is an optional argument, and it defaults to zero. If this argument is non-zero, the width of the column range specified by the second and third argument values is reduced to a maximum of 256. </dl>


==Usage Notes==
==Usage notes==
<ul><li>If the input Stringlist was associated with an image, by either the BindImage or New method, the Subset output Stringlist identifier is associated with the same image.<li>While, under ''[[Sirius Mods]]'' Version 6.6 and later, Stringlist items can be longer than 6124 bytes long, the Subset method will only look for matches in the first 6124 bytes of any Stringlist item.</ul>
<ul><li>If the input Stringlist was associated with an image, by either the BindImage or New method, the Subset output Stringlist identifier is associated with the same image.<li>While, under ''[[Sirius Mods]]'' Version 6.6 and later, Stringlist items can be longer than 6124 bytes long, the Subset method will only look for matches in the first 6124 bytes of any Stringlist item.</ul>



Revision as of 20:05, 31 December 2010

Create Stringlist subset (Stringlist class)


Subset is a member of the Stringlist class.

This method creates a Stringlist that is a subset of the method Stringlist. The subset is created by selecting all entries that contain a specified search string.

Syntax

%outList = sl:Subset( string, [[StartColumn=] number], [[EndColumn=] number], - [[CaseIndependent=] number], [[ArbitraryQuote=] number])

Syntax terms

%outlist
A reference to a Stringlist which is set to the newly-created subset Stringlist.
%sl
A Stringlist object.
string
The string to be located. This argument is called the search string.
startcol
The starting column number of the range of columns in which the search string must be located. This is an optional argument, and it defaults to 1.
endcol
The ending column number of the range of columns in which the search string must be located. This is an optional argument which defaults to 6124. If endcol is a non-zero integer, the width of the column range is reduced to a maximum of 256.
caseflag
An indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use the Stringlist item data translated to uppercase (so the search string should be passed as an uppercase value). This is an optional argument, and it defaults to zero. If this argument is non-zero, the width of the column range specified by the second and third argument values is reduced to a maximum of 256.

Usage notes

  • If the input Stringlist was associated with an image, by either the BindImage or New method, the Subset output Stringlist identifier is associated with the same image.
  • While, under Sirius Mods Version 6.6 and later, Stringlist items can be longer than 6124 bytes long, the Subset method will only look for matches in the first 6124 bytes of any Stringlist item.

Examples

In the following example, a Stringlist is loaded from the contents of a procedure, and all lines that contain the string "%critical" (independent of case) are displayed:

%list = new
%rc = $procopn('BIGPROC', 'PROCFILE')
%list:appendOpenProcedure

%list = %list:subset('%CRITICAL', , , 1)
%listrint