Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer

$PIECE

1995 Version of ANSI (Equivalent to Current ISO Version) of Standard

Right Hand Pointer

7.1.5.12 $Piece

$P[IECE] ( expr1 , expr2 )

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. $Piece(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 )

Let m be the integer value of intexpr. $Piece(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 )

Let n be the integer value of intexpr2. $Piece(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-2018 MUMPS Development Committee;
Copyright © Examples: 1995-2018 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2018 Ed de Moel.

This page most recently updated on 13-Sep-2014, 17:20:54 .

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