I may not understand the nuances here, but on it’s face, that seems like something I would use “string map” for. I’ve used string map on HL7 characters before, without issue. Without testing it, I think the command would be:
It is not something you would do in Xlate but perhaps a route pre-proc
If there are always 2 or three the string map as recommended by Brandon would be your best bet. However if you want to collapse any number of ~ into one you would do something like: (Assumes msg holds HL7 message)