String data to structured string VAT number

188 Views Asked by At

Our API is receiving VAT numbers as a 'string' data value without symbols. e.g. 'BE0123123123' and should be "transformed" into a structured field: 'BE 0123.123.123' input length will always be the same length and type.

Any suggestions on what would be the best approach?

1

There are 1 best solutions below

0
On

There are many solutions, one of them can be regex

Regex.Replace(input, @"(\w{2})(\w{4})(\w{3})(\w{3})", @"$1 $2.$3.$4");