Difference between revisions of "ALINES()"

From Recital Documentation Wiki
Jump to: navigation, search
Line 5: Line 5:
  
 
==Purpose==
 
==Purpose==
Function to fill an array with character strings that are separated with a newline or other specified character
+
Function to fill an array with character strings that are separated with a newline or other specified parsing string
  
  
Line 18: Line 18:
 
==Description==
 
==Description==
 
The ASTORE() function fills the <array> with character strings from <expC1> which are separated by the character specified in <expC2>.  The array must have been previously declared.  The character strings are copied into the array elements until either all the elements are filled, or all the strings are copied.  The length of the array is automatically shortened to the number of elements stored in it.  The ASTORE() function returns the number of character strings copied into the array.  The ASTORE() function is most commonly used in combination with menu commands where multiple selections can be made.
 
The ASTORE() function fills the <array> with character strings from <expC1> which are separated by the character specified in <expC2>.  The array must have been previously declared.  The character strings are copied into the array elements until either all the elements are filled, or all the strings are copied.  The length of the array is automatically shortened to the number of elements stored in it.  The ASTORE() function returns the number of character strings copied into the array.  The ASTORE() function is most commonly used in combination with menu commands where multiple selections can be made.
 +
 +
====<expN>====
 +
 +
The <expN> is the sum of the required flags:
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 32: Line 36:
 
|4||16||Include the parsing characters.
 
|4||16||Include the parsing characters.
 
|}
 
|}
 +
 +
 +
====<expC2>====
 +
The optional <expC2> specifies an alternative parsing string.  The string of one or more characters is used to signify a line break instead of the newline characterr.
  
  

Revision as of 16:35, 25 November 2009

Template:YLM to do

Fills an array with elements of a string separated by newline (default) numeric = alines(arrayname, string as character [,flags as numeric [, separator as character] ] )

Purpose

Function to fill an array with character strings that are separated with a newline or other specified parsing string


Syntax

ALINES(<array>, <expC1> [<expN> [, <expC2>]])


See Also

AADD(), AAVERAGE(), ABROWSE(), ACHOICE(), ACOL(), ACOPY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, AROW(), ARRAY(), ASCAN(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COPY TO ARRAY, DBEDIT(), DECLARE, DIMENSION, FILETOSTR(), GATHER, IN_ARRAY(), LOCAL, MENU AT, MENU BROWSE, MENU FIELDS, MENU FILES, MENU FROM, MENUITEM(), PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER


Description

The ASTORE() function fills the <array> with character strings from <expC1> which are separated by the character specified in <expC2>. The array must have been previously declared. The character strings are copied into the array elements until either all the elements are filled, or all the strings are copied. The length of the array is automatically shortened to the number of elements stored in it. The ASTORE() function returns the number of character strings copied into the array. The ASTORE() function is most commonly used in combination with menu commands where multiple selections can be made.

<expN>

The <expN> is the sum of the required flags:

Bit Value (additive) Description
0 1 Removes leading and trailing spaces from lines, or for memos and BLOBs, removes trailing zeroes (0) instead of spaces. This is the default.
1 2 Include the last element in the array even if the element is empty.
2 4 Do not include empty elements in the array.
3 8 Case-insensitive parsing.
4 16 Include the parsing characters.


<expC2>

The optional <expC2> specifies an alternative parsing string. The string of one or more characters is used to signify a line break instead of the newline characterr.


Example

// ali.prg - 4 lines
cVar=filetostr("ali.prg")
nVar = alines(aVar, cVar)
echo "Program has " + ltrim(str(nVar)) + " lines\n"
 
declare aNums[10]
? alen(aNums)
        10
nelements = ASTORE(aNums, "one, two, three", ",")
? nelements
         3
? alen(aNums)
         3
// Another Example
menu fields select "+"
declare aMenu[512]
nelements = astore(aMenu, menuitem(), "+")


Products

Recital, Recital Server