This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21584|Reply: 1

[Source] .net/c# string. Format "The input string is formatted incorrectly"

[Copy link]
Posted on 9/2/2017 5:47:53 PM | | | |


I recently did a project using string. Format When sorting out the data, an error is always reported: the input string is not formatted correctly.
I struggled for a long time. Finally, I checked the information and finally knew what the problem was. Now document this issue:

In the code, the result needs to be output as a Js string. At the beginning, the code is written as follows:


Later, after looking up some information, I knew what the problem was.
What if you use a format placeholder like {0}, {1:yyyy-MM-dd} in C# if the formatted string itself contains { or }? The answer is: use two { or } conjunctions to represent a single one.

My code problem is in this place. After the modification, the modified code is as follows:








Previous:.net/C# version of Escape() and Unescape() functions are shared
Next:Check-in and sign-in
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com