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

$PIECE

1990 Version of ANSI Standard

2.2.7.12 $Piece

$P[IECE] ( expr1 , expr2 )

See 2.3 for the definition of expr.

This form 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 m, 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,0,NF(s,d,1) - $L(d) - 1).

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

See 2.3 for the definition of expr. See 2.2.4.1 for the definition of intexpr.

Let m be the integer value of intexpr. $P(s,d,m) returns the substring of s bounded by but not including the m–1th 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 , intexpr1 , intexpr2 )

See 2.3 for the definition of expr. See 2.2.4.1 for the definition of intexpr.

Let n be the integer value of intexpr2. $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).

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)