Difference between revisions of "MUMPS Functions $PIECE"

From VistApedia
Jump to: navigation, search
 
(Added a glossary link to record~)
 
Line 1: Line 1:
The $PIECE function returns a substring delimited by a specified string delimiter made up of one or more characters. In M, $PIECE() returns a logical field from a logical record.
+
The $PIECE function returns a substring delimited by a specified string delimiter made up of one or more characters. In M, $PIECE() returns a logical field from a logical [[record~|Record]].
  
 
$PIECE() provides a tool for efficiently using values that contain multiple elements or fields, each of which may be variable in length.  
 
$PIECE() provides a tool for efficiently using values that contain multiple elements or fields, each of which may be variable in length.  

Latest revision as of 13:54, 1 April 2012

The $PIECE function returns a substring delimited by a specified string delimiter made up of one or more characters. In M, $PIECE() returns a logical field from a logical Record.

$PIECE() provides a tool for efficiently using values that contain multiple elements or fields, each of which may be variable in length.

Example:

GTM> FOR i=0:1:3 WRITE !,$PIECE("1 2"," ",i),"<" 
< 
1< 
2< 
< 
GTM> 

This loop displays the result of $PIECE(), specifying a space as a delimiter, a piece position "before," first and second, and "after" the string.