source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCCVEGU0.m@ 1133

Last change on this file since 1133 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.5 KB
Line 
1SCCVEGU0 ;ALB/JRP - UTILS FOR ENCNTR CNVRSN GLBL ESTMTR;11-JAN-1996
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3INSERT(INSTR,OUTSTR,COLUMN,LENGTH) ;INSERT A STRING INTO ANOTHER
4 ;INPUT : INSTR - String to insert
5 ; OUTSTR - String to insert into
6 ; COLUMN - Where to begin insertion (defaults to end of OUTSTR)
7 ; LENGTH - Number of characters to clear from OUTSTR
8 ; (defaults to length of INSTR)
9 ;OUTPUT : s - INSTR will be placed into OUTSTR starting at COLUMN
10 ; using LENGTH characters
11 ; "" - Error (bad input)
12 ;
13 ;NOTE : This module is based on $$SETSTR^VALM1
14 ;
15 N STRING
16 Q:'$D(INSTR)!'$D(OUTSTR) ""
17 I '$G(COLUMN) N COLUMN S COLUMN=$L(OUTSTR)+1
18 I '$G(LENGTH) N LENGTH S LENGTH=$L(INSTR)
19 S INSTR=$S($L(INSTR)<LENGTH:INSTR_$J("",LENGTH-$L(INSTR)),1:INSTR)
20 S $E(OUTSTR,COLUMN,COLUMN+LENGTH-1)=INSTR
21 Q OUTSTR
22 ;
23CENTER(CNTRSTR,MARGIN) ;CENTER A STRING
24 ;INPUT : CNTRSTR - String to center
25 ; MARGIN - Margin width to center within (defaults to 80)
26 ;OUTPUT : s - INSTR will be centered in a margin width of MARGIN
27 ; "" - Error (bad input)
28 ;NOTES : A margin width of 80 will be used when MARGIN<1
29 ; : CNTRSTR will be returned when $L(CNTRSTR)>MARGIN
30 ;
31 N STRING,FROM
32 ;Check input
33 Q:($G(CNTRSTR)="") ""
34 I $G(MARGIN)<1 N MARGIN S MARGIN=80
35 Q:($L(CNTRSTR)>MARGIN) CNTRSTR
36 S STRING="",$P(STRING," ",MARGIN+1)="",FROM=(MARGIN\2)-($L(CNTRSTR)\2)+1
37 S $E(STRING,FROM,FROM+$L(CNTRSTR)-1)=CNTRSTR
38 Q STRING
39 ;
Note: See TracBrowser for help on using the repository browser.