Written by

Enterprise Application Development Consultant at The Ohio State University Wexner Medical Center
MOD
Question Scott Roth · 2 hr ago

Alt Fractional Codes in Strings formatting

Our Pharmacy team would like us to convert...

¼ test character and ½ test character and ¾ test character and

to more like 

1/4 test character and 1/2 test character and 3/4 test character and

Is this possible?

Product version: IRIS 2025.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2025.1 (Build 230_2U) Wed Jun 4 2025 18:50:44

Comments

Robert Cemper · 1 hr ago

It is possible by using $replace function: some string to a different string
you define your fractional codes and run them in iterative loops 

USER>read txt
¼ test character and ½ test character and ¾ test character and
USER>s a14=$c(188)
USER>s a12=$c(189)
USER>s a34=$c(190) 
USER>s a17=$c(8528)

USER>write $replace($replace(txt,a14,"1/4"),a12,"1/2")
1/4 test character and 1/2 test character and ¾ test character and
USER>

Attention: 
Some codes are wide characters:  this makes the replacement tricky
example. 1/7 >> $c(8528) !!

0