Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

$PIECE

1984 Version of ANSI Standard

3.2.8 Functions function

$P[IECE] ( expr1 , expr2 )

is defined here with the aid of a function, NF, which is used for definitional purposes only, called "find the position number following the mth occurrence".

NF(s,d,m) is defined, for strings s, d, and integer in, as follows:

Let s be the value of expr1, and let d be the value of expr2. $P(s,d) returns the substring of s bounded on the right but not including the first (leftmost) occurrence of d.

$P(s,d) = $E(s,O,NF(s,d,1) - $L(d) - 1).

$P[IECE]( expr1 , expr2 , intexpr3 )

Let m be the integer value of intexpr3. $P(s,d,m) returns the substring of s bounded by but not including the m-lth and the mth occurrence of d.

$P(s,d,m) _ $E(s,NF(s,d,m–1),NF(s,d,m) - $L(d) - 1).

$P[IECE]( expr1 , expr2 , intexpr3 , intexpr4 )

Let n be the integer value of intexpr4. $P(s,d,m,n) returns the substring of s bounded on the left but not including the m–1th occurrence of d in s, and bounded on the right but not including the nth occurrence of d in s.

$P(s,d,m,n) _ $E(s,NF(s,d,m–1),NF(s,d,n) - $L(d) - 1).

Note that $P(s,d,m,m) - $P(s,d,m), and that $P(s,d,1) - $P(s,d).

See also the transition diagram for $Piece.

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

This page most recently updated on 15-Nov-2023, 13:11:13.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)