In this post, we’ll examine the text handling capabilities of the .NET Framework. We’ll review three major objectives of 70-536:
- StringBuilder class
- Regular Expressions
- Encoding and Decoding text
Strings in the .NET Framework are immutable. Memorize it, immutable. They cannot be altered. Instead, every time you modify a string a new instance of String is created with the new value, and the pointer will be assigned to the memory location of your new string. So when you need to dynamically build strings (for example, adding it line by line), you should use the StringBuilder class.
Don’t let yourself fooled by the title, we’ll discuss the topics of Globalization here. You’ll need the System.Globalization and System.Threading namespaces and possibly Sysglobl.dll to build custom cultures.
A little terminology: today, culture will mean the language, currency, date-format, calendar, writing system and different names of a given group of people. There are two types of cultures: neutral, which only provides information of the language spoken, and specific culture, which provides information about the region/country. For example “es” means the Spanish neutral culture, and “es-MX” means the Mexican culture with the appropriate region information (such as the unit of currency, date format, etc.). There’s also a special culture, called Invariant culture. This one is associated with the English language, but not with any region/country. You’ll use this one when you need consistency across different cultures in your application.