Click here to Skip to main content
15,042,088 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am new to programming and I have this string str = -876543345672;
I am trying to get the output as "[-876543345672]"

What I have tried:

I tried the replace method but did not achieve the desired output.
Updated 2-Jul-20 11:39am

1 solution

string str = "-876543345672";
str = $"[{str}]";

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900