|< Day Day Up >|
The demands of working with text have increased considerably from the days when it meant dealing with 7-bit ASCII or ANSII characters. Today, the Unicode standard defines the representation of more than 90,000 characters comprising the world's alphabets. We've seen that .NET fully embraces this standard with its 16-bit characters. In addition, it supports the concept of localization, which ensures that a machine's local culture information is taken into account when manipulating and representing data strings.
String handling is facilitated by a rich set of methods available through the String and StringBuilder classes. A variety of string comparison methods are available with options to include case and culture in the comparisons. The String.Format method is of particular note with its capacity to display dates and numbers in a wide range of standard and custom formats. String manipulation and concatenation can result in an inefficient use of memory. We saw how the StringBuilder class is an efficient alternative for basic string operations. Applications that require sophisticated pattern matching, parsing, and string extraction can use regular expressions in conjunction with the Regex class.
The System.IO namespace provides a number of classes for reading and writing data: The FileStream class is used to process raw bytes of data; MemoryStream and BufferedStream allow bytes to be written to memory or buffered; the StreamReader and StreamWriter classes support the more traditional line-oriented I/O. Operations related to managing files and directories are available as methods on the File, FileInfo, Directory, and DirectoryInfo classes. These are used to create, copy, delete, and list files and directories.
|< Day Day Up >|