I need help formatting a string

Analytics
N/A

I need help formatting a string

The sting value is 0000120160310000098

I would like it to be 1-16-310-00098

 

The first dash replaces 20

The second and third dash replace a 0

 

I can' t seem to figure out how to do it.

 

2 REPLIES
N/A

Re: I need help formatting a string

What are the rules for replacing '20' & '0'?

 

Why results '0000120160310000098' in '1-16-310-00098' and not '1-16031-000-98' or '----1-16031-----98'?

 

Teradata Employee

Re: I need help formatting a string

Substr or Substring functions would work in this case, but as DNoeth points out, we don't know the general case.