在 .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 StringsParsing Strings
說明如何將物件初始化為這些物件的字串表示所描述的值。Describes how to initialize objects to the values described by string representations of those objects. 剖析是格式化的反向作業。Parsing is the inverse operation of formatting.