Question
· Dec 15, 2017

$ZSTRIP removing too many characters

We are seeing something funky when using $ZSTRIP.

w $ZSTRIP("ZZZZTESTSLOCKTEST","<","ZZZZTEST")
LOCKTES
T

Shouldn't this be returning....SLOCKTEST and not LOCKTEST, the goal is to remove ZZZZTEST from the beginning of the string.

THanks

Scott Roth

The Ohio State University Wexner Medical Center

Discussion (1)1
Log in or sign up to continue

You wrong because you missed something important in the documentation. The third parameter is not about string, it is about the list of chars, and the last one the same. So, it will remove everything at the beginning if any of defined characters it will be. And order does not matter.

Write $ZSTRIP("ZZZZTESTSLOCKTEST","<","ETSZ")

return the same

If you have to remove fixed string, you can use $piece or $replace

Write $p("ZZZZTESTSLOCKTEST","ZZZZTEST",2,*)
SLOCKTEST