控制 .NET 中的字符串Manipulating Strings in .NET

.NET 提供了一组广泛的例程,使你可以高效地创建、比较和修改字符串,以及快速分析大量文本和数据以搜索、删除和替换文本模式。.NET provides an extensive set of routines that enable you to efficiently create, compare, and modify strings as well as rapidly parse large amounts of text and data to search for, remove, and replace text patterns.

本节内容In This Section

有关使用字符串的最佳做法Best Practices for Using Strings
介绍了 .NET 中的字符串排序、比较和大小写转换方法,提出了有关如何选择字符串处理方法的建议。Examines string-sorting, comparison, and casing methods in .NET, and provides recommendations for selecting a string-handling method .

.NET 正则表达式.NET Regular Expressions
详细介绍了 .NET 正则表达式,包括语言元素、正则表达式行为和示例。Provides detailed information about .NET regular expressions, including language elements, regular expression behavior, and examples.

基本字符串操作Basic String Operations
介绍了 System.StringSystem.Text.StringBuilder 类提供的字符串操作,包括通过字节数组新建字符串、比较字符串值和修改现有字符串。Describes string operations provided by the System.String and System.Text.StringBuilder classes, including creating new strings from arrays of bytes, comparing string values, and modifying existing strings.

.NET 中的类型转换Type Conversion in .NET
介绍了使用 .NET 转换类型的技术和规则。Explains the techniques and rules used to convert types using .NET.

格式设置类型Formatting Types
介绍了如何使用基类库实现格式设置、如何设置数字类型的格式、如何设置字符串类型的格式,以及如何针对特定区域性设置格式。Provides how to use the base class library to implement formatting, how to format numeric types, how to format string types, and how to format for a specific culture.

分析字符串Parsing Strings
描述如何将对象初始化为这些对象的字符串表示形式所描述的值。Describes how to initialize objects to the values described by string representations of those objects. 分析是格式化的反向操作。Parsing is the inverse operation of formatting.