C# string format delimiter 12-3456789-0 -


i have below string.

1234567890 

i want string.

12-3456789-0 

i tried using below code.

string.format("{0:0-#######-#}", "1234567890"); 

but result not want.

1234567890 

fiddle

the reason code not work because specifying number-formatting string.

look:

string.format("{0:0-#######-#}", "1234567890"); // "1234567890" string 

try instead:

string.format("{0:0-#######-#}", 1234567890); // 1234567890 number 

incidentally, output want, format string needs {0:0#-#######-#}


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -