Hi all, I struggle for some time now changing the output of a CF.
Let ( [ digits = "0123456789" ; len = Length ( text ) ; num1 = not IsEmpty ( Filter ( Left ( text ; 1 ) ; digits ) ) ; num2 = not IsEmpty ( Filter ( Middle ( text ; 2 ; 1 ) ; digits ) ) ] ; Case ( num1 and num2 ; Left ( text ; 2 ) & Case ( len > 2 ; "-" & PLCFormat ( Right ( text ; len - 2 ) ) ) ; num1 xor num2 ; Left ( text ; 1 ) & Case ( len > 1 ; "-" & PLCFormat ( Right ( text ; len - 1 ) ) ) ; Left ( text ; 1 ) & Case ( len > 1 ; PLCFormat ( Right ( text ; len - 1 ) ) ) ) ) This CF returns the possible digits in an input field in groups of 2 with a dash. When there are letters involved, they are also separated from the number/digits by a dash. Example input/output: TA123/TA-12-3 1234JKL/12-34-JKL 123TA45/12-3-TA-45 I need an additional output form when the numbers are a group of 5 digits. TA12345 needs to be TA-12-345 12345JK needs to be 12-235-JK By now I know I have to test not only for the first 2 characters, but also for 3 and 4. Reason is, if 3 is a digit, and 4 not, I need to output 3 characters and a dash (instead of just 2 and a dash as before). So, I need to keep the output like it is now, only when there are 5 consecutive digits, the return needs to be a group of 2/dash/group of 3, with possible letters. Any hint, idea, solution....?
