Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  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
Code Block
languagejavascript
  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 = pjs.move(FIELD1, 'YARYRYY');
FIELD2 = pjs.move(FIELD2, 'Y');
 
  FIELD1.scanToArray(Arr1, FIELD2, 3);
 // Arr1 holds result = Arr1[1] + Arr1[2] + Arr1[3];[4, 6, 7]