String 成员

表示文本,即一系列 Unicode 字符。

下表列出了由 String 类型公开的成员。

公共构造函数

  名称 说明
Public method Supported by the .NET Compact Framework String 已重载。初始化 String 类的新实例。

页首

公共字段

  名称 说明
Public field Static Supported by the .NET Compact Framework Empty 表示空字符串。此字段为只读。

页首

公共属性

  名称 说明
Public property Supported by the .NET Compact Framework Chars 获取此实例中位于指定字符位置的字符。
Public property Supported by the .NET Compact Framework Length 获取此实例中的字符数。

页首

公共方法

  名称 说明
Public method Supported by the .NET Compact Framework Clone 返回对此 String 实例的引用。
Public method Static Supported by the .NET Compact Framework Compare 已重载。 比较两个指定的 String 对象。
Public method Static CompareOrdinal 已重载。 通过计算每个字符串中相应 Char 对象的数值来比较两个 String 对象。
Public method CompareTo 已重载。 将此实例与指定的对象或 String 进行比较,并返回二者相对值的指示。
Public method Static Supported by the .NET Compact Framework Concat 已重载。 连接 String 的一个或多个实例,或 Object 的一个或多个实例的值的 String 表示形式。
Public method Contains 返回一个值,该值指示指定的 String 对象是否出现在此字符串中。
Public method Static Supported by the .NET Compact Framework Copy 创建一个与指定的 String 具有相同值的 String 的新实例。
Public method Supported by the .NET Compact Framework CopyTo 将指定数目的字符从此实例中的指定位置复制到 Unicode 字符数组中的指定位置。
Public method Supported by the .NET Compact Framework EndsWith 已重载。 确定 String 的实例的末尾是否与指定的字符串匹配。
Public method Supported by the .NET Compact Framework Equals 已重载。 已重写。 确定两个 String 对象是否具有相同的值。
Public method Static Supported by the .NET Compact Framework Format 已重载。 将指定的 String 中的每个格式项替换为相应对象的值的文本等效项。
Public method GetEnumerator 检索一个可以循环访问此字符串中的每个字符的对象。
Public method Supported by the .NET Compact Framework GetHashCode 已重写。 返回该字符串的哈希代码。
Public method Supported by the .NET Compact Framework GetType  获取当前实例的 Type。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework GetTypeCode 返回类 StringTypeCode
Public method Supported by the .NET Compact Framework IndexOf 已重载。 报告 String 或一个或多个字符在此字符串中的第一个匹配项的索引。
Public method Supported by the .NET Compact Framework IndexOfAny 已重载。 报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的索引。
Public method Supported by the .NET Compact Framework Insert 在此实例中的指定索引位置插入一个指定的 String 实例。
Public method Static Supported by the .NET Compact Framework Intern 检索系统对指定 String 的引用。
Public method Static Supported by the .NET Compact Framework IsInterned 检索对指定 String 的引用。
Public method IsNormalized 已重载。 指示此字符串是否符合特定的 Unicode 范式。
Public method Static Supported by the .NET Compact Framework IsNullOrEmpty 指示指定的 String 对象是 空引用(在 Visual Basic 中为 Nothing) 还是 Empty 字符串。
Public method Static Supported by the .NET Compact Framework Join 已重载。 在指定 String 数组的每个元素之间串联指定的分隔符 String,从而产生单个串联的字符串。
Public method Supported by the .NET Compact Framework LastIndexOf 已重载。 报告指定的 Unicode 字符或 String 在此实例中的最后一个匹配项的索引位置。
Public method Supported by the .NET Compact Framework LastIndexOfAny 已重载。 报告在 Unicode 数组中指定的一个或多个字符在此实例中的最后一个匹配项的索引位置。
Public method Normalize 已重载。 返回一个新字符串,其二进制表示形式符合特定的 Unicode 范式。
Public method Static Supported by the .NET Compact Framework op_Equality 确定两个指定的 String 对象是否具有同一值。
Public method Static Supported by the .NET Compact Framework op_Inequality 确定两个指定的 String 对象是否具有不同的值。
Public method Supported by the .NET Compact Framework PadLeft 已重载。 右对齐此实例中的字符,在左边用空格或指定的 Unicode 字符填充以达到指定的总长度。
Public method Supported by the .NET Compact Framework PadRight 已重载。 左对齐此字符串中的字符,在右边用空格或指定的 Unicode 字符填充以达到指定的总长度。
Public method Static Supported by the .NET Compact Framework ReferenceEquals  确定指定的 Object 实例是否是相同的实例。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework Remove 已重载。 从此实例中删除指定个数的字符。
Public method Supported by the .NET Compact Framework Replace 已重载。 将此实例中的指定 Unicode 字符或 String 的所有匹配项替换为其他指定的 Unicode 字符或 String
Public method Supported by the .NET Compact Framework Split 已重载。 返回包含此实例中的子字符串(由指定 CharString 数组的元素分隔)的 String 数组。
Public method Supported by the .NET Compact Framework StartsWith 已重载。 确定 String 实例的开头是否与指定的字符串匹配。
Public method Supported by the .NET Compact Framework Substring 已重载。 从此实例检索子字符串。
Public method Supported by the .NET Compact Framework ToCharArray 已重载。 将此实例中的字符复制到 Unicode 字符数组。
Public method Supported by the .NET Compact Framework ToLower 已重载。 返回此 String 转换为小写形式的副本。
Public method ToLowerInvariant 返回此 String 对象的转换为小写形式的副本,返回时使用固定区域性的大小写规则。
Public method Supported by the .NET Compact Framework ToString 已重载。 已重写。 将此实例的值转换为 String
Public method Supported by the .NET Compact Framework ToUpper 已重载。 返回此 String 转换为大写形式的副本。
Public method Supported by the .NET Compact Framework ToUpperInvariant 返回此 String 对象的转换为大写形式的副本,返回时使用固定区域性的大小写规则。
Public method Supported by the .NET Compact Framework Trim 已重载。 从此实例的开始位置和末尾移除一组指定字符的所有匹配项。
Public method Supported by the .NET Compact Framework TrimEnd 从此实例的结尾移除数组中指定的一组字符的所有匹配项。
Public method Supported by the .NET Compact Framework TrimStart 从此实例的开始位置移除数组中指定的一组字符的所有匹配项。

页首

显式接口实现

  名称 说明
Explicit interface implementation Method Supported by the .NET Compact Framework System.Collections.Generic.IEnumerable<System.Char>.GetEnumerator 返回循环访问当前 String 对象的枚举数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.Collections.IEnumerable.GetEnumerator 返回循环访问当前 String 对象的枚举数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToBoolean 将当前 String 对象的值转换成布尔值。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToByte 将当前 String 对象的值转换为 8 位无符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToChar 将长度为 1 的非空字符串转换为 Char 对象。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToDateTime 将当前 String 对象的值转换为日期和时间。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToDecimal 将当前 String 对象的值转换为十进制数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToDouble 将当前 String 对象的值转换为双精度浮点数字。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToInt16 将当前 String 对象的值转换为 16 位有符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToInt32 将当前 String 对象的值转换为 32 位有符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToInt64 将当前 String 对象的值转换为 64 位有符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToSByte 将当前 String 对象的值转换为 8 位有符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToSingle 将当前 String 对象的值转换为单精度浮点数字。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToType 将当前 String 对象的值转换为指定类型的对象。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToUInt16 将当前 String 对象的值转换为 16 位无符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToUInt32 将当前 String 对象的值转换为 32 位无符号整数。
Explicit interface implementation Method Supported by the .NET Compact Framework System.IConvertible.ToUInt64 将当前 String 对象的值转换为 64 位无符号整数。

页首

请参见

参考

String 类
System 命名空间
IComparable 接口
ICloneable 接口
IConvertible 接口
IEnumerable
System.Text.StringBuilder
CultureInfo

其他资源

格式化概述