Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

string.scanToArray() provides the ability to look for a value in a string and puts the results into an array.

Parameters
  1. Array to put results into
  2. Value to look for
  3. Index to start from (optional) - if omitted, the search starts from the beginning of the string; the first character in the string is considered position 1
  4. Length to search for (optional) - if omitted, the rest of the string is searched
Return Value

An array of numeric positions that represent found values. The first character in the string is considered position 1.

Example
pjs.define("Arr1", { type: 'packed decimal', length: 1, decimals: 0, dim: 3 });
pjs.define("FIELD1", { type: 'char', length: 7 });
pjs.define("FIELD2", { type: 'char', length: 1 });

FIELD1 = 'YARYRYY';
FIELD2 = 'Y';
 
FIELD1.scanToArray(Arr1, FIELD2, 3);
// Arr1 holds [4, 6, 7]
  • No labels