- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
String Template Class in C#
StringTemplate class is used to parse the format string, so that it is compatible with String.Format. The StringTemplate class comes under the NString library that has extension methods. These methods makes string manipulations easy to use like.
IsNullOrEmpty() IsNullOrWhiteSpace() Join() Truncate() Left() Right() Capitalize()
StringTemplate.Format is better than String.Format since it is more readable and less prone to errors.
The order of the values can be easily formatted. The values are formatted in a way similar to String.Format, but with named placeholders instead of numbered placeholders.
The following is a sample −
string str = StringTemplate.Format("{ExamName} will held on {ExamDate:D}", new { p.ExamName, p.ExamDate });
Advertisements