troubleshooting Question

c# Converting verbatim string to literal string

Avatar of mr_fnord1
mr_fnord1 asked on
2 Comments1 Solution2382 ViewsLast Modified:
I am trying to feed string.Format from a textbox input. When escape characters are entered in the textbox, the Text property is treated as a verbatim string, and I can't find a way to have this verbatim string interpretted as if it was a literal string.

txtFormat.Text contains the following string:
'\t{0} - {1}\t\t{2}\r\n'

outputText.Text = string.Format(txtFormat.Text, f.Name, f.Length, f.CreationTime, f.DirectoryName, f.LastAccessTime, f.LastWriteTime));

outputText.Text displays:
'\tName - 9999\t\t1/1/1900\r\n'
instead of
'      Name - 9999            1/1/1900

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros