phoffman35

concatenate substrings

Discussion created by phoffman35 on Oct 30, 2013
Latest reply on Oct 31, 2013 by csny490
I have an existing vb script that I want to convert to python.
Here is the VB example:

Example for HDREFNO is R03960037

Mid( [HDREF_NO],1,3 ) & "-" & Mid( [HDREF_NO],4,2) & "-" & Mid( [HDREF_NO],6,4) 

I want a result of R03-96-0037

I have tried :

!HDREF_NO![0:2] +"-"+ !HDREF_NO![3:2] +"-"+ !HDREF_NO![5:4]

This gives me:
R03--

What is the correct code?

Thanks,

Outcomes