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

$%REPLACE

Draft MDC Standard

3 STRING Library
3.6 REPLACE

REPLACE(IN,SPEC) ;
	New L,MASK,K,I,LT,F,VALUE
	Set L=$Length(IN),MASK=$JUSTIfY("",L)
	Set I="" For  Set I=$Order(SPEC(I)) Quit:I=""  Do
	. Quit:'($Data(SPEC(I,1))#2)
	. Quit:SPEC(I,1)=""
	. Quit:'($Data(SPEC(I,2))#2)
	. Set LT=$Length(SPEC(I,1))
	. Set F=0 For  Set F=$Find(IN,SPEC(I,1),F) Quit:F<1  Do
	. . Quit:$Extract(MASK,F-LT,F-1)["X"
	. . Set VALUE(F-LT)=SPEC(I,2)
	. . Set $Extract(MASK,F-LT,F-1)=$TRanslate($Justify("",LT)," ","X")
	. . Quit
	. Quit
	Set VALUE="" For K=1:1:L Do
	. If $Extract(MASK,K)=" " Set VALUE=VALUE_$Extract(IN,K) Quit
	. Set:$Data(VALUE(K)) VALUE=VALUE_VALUE(K)
	. Quit
	Quit VALUE
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.

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 16-Nov-2023, 16:55:46.

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