当前位置:K88软件开发文章中心编程语言.NET.NET02 → 文章内容

VB.Net - 字符串

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:58:58

17 Public Function IndexOfAny ( anyOf As Char() ) As Integer公共函数IndexOfAny(anyOf为CHAR())As Integer返回在指定的Unicode字符数组中的任何字符的此实例中第一次出现的从零开始的索引。 18 Public Function IndexOfAny ( anyOf As Char(), startIndex As Integer ) As Integer公共函数IndexOfAny(anyOf为char(),则startIndex作为整数)As Integer 返回在指定的Unicode字符数组中的任意字符的此实例中第一次出现的从零开始的索引,开始在指定的字符位置搜索。 19 Public Function Insert ( startIndex As Integer, value As String ) As String公共函数Insert(的startIndex为整数,值作为字符串)As String 返回一个新字符串,其中指定的字符串插入到当前字符串对象中指定的索引位置。 20 Public Shared Function IsNullOrEmpty ( value As String ) As Boolean公共共享函数IsNullOrEmpty(值作为字符串) As Boolean 指示指定的字符串是空还是空字符串。 21 Public Shared Function Join ( separator As String, ParamArray value As String() ) As String公共共享函数加入(分隔符作为字符串,值的ParamArray作为字符串())As String 连接字符串数组的所有元素,使用每个元素之间指定的分隔符。 22 Public Shared Function Join ( separator As String, value As String(), startIndex As Integer, count As Integer ) As String公共共享函数加入(分隔符作为字符串,值作为字符串(),则startIndex整数,算作整数)As String 使用每个元素之间指定的分隔符连接字符串数组的指定元素。 23 Public Function LastIndexOf ( value As Char ) As Integer公共函数LastIndexOf(价值为CHAR) As Integer 返回当前字符串对象中指定Unicode字符的最后一次出现的从零开始的索引位置。 24 Public Function LastIndexOf ( value As String ) As Integer公共函数LastIndexOf(值作为字符串) As Integer 返回当前字符串对象中指定字符串的最后一次出现的从零开始的索引位置。 25 Public Function Remove ( startIndex As Integer )As String字符串作为公共函数删除 (startIndex 作为整数)As String 删除当前实例中的所有字符,从指定位置开始,并继续到最后一个位置,并返回字符串。 26 Public Function Remove ( startIndex As Integer, count As Integer ) As String字符串作为公共函数删除 (startIndex 作为整数作为整数计数)As String 从指定位置开始删除当前字符串中指定数量的字符,并返回字符串。 27 Public Function Replace ( oldChar As Char, newChar As Char ) As String公共函数替换(oldChar为char,newChar为CHAR)As String 用指定的Unicode字符替换当前字符串对象中指定Unicode字符的所有出现,并返回新字符串。 28 Public Function Replace ( oldValue As String, newValue As String ) As String公共功能替换(属性oldValue作为字符串,newValue作为字符串)As String将当前字符串对象中指定字符串的所有出现替换为指定的字符串,并返回新字符串。 29 Public Function Split ( ParamArray separator As Char() ) As String()公共函数拆分(ParamArray分隔符作为Char())As String() 返回一个字符串数组,其中包含当前字符串对象中的子字符串,由指定的Unicode字符数组的元素分隔。 30 Public Function Split ( separator As Char(), count As Integer ) As String()公共函数分割(分隔符为char(),计数为整数)As String() 返回一个字符串数组,其中包含当前字符串对象中的子字符串,由指定的Unicode字符数组的元素分隔。 int参数指定要返回的子字符串的最大数目。 31 Public Function StartsWith ( value As String ) As Boolean公共函数StartsWith(值作为字符串)As Boolean 确定此字符串实例的开头是否与指定的字符串匹配。 32 Public Function ToCharArray As Char()公共函数ToCharArray As CHAR() 返回包含当前字符串对象中所有字符的Unicode字符数组。 33 Public Function ToCharArray ( startIndex As Integer, length As Integer ) As Char()公共函数ToCharArray(startIndex为整数,length为整数) As Char() 返回一个Unicode字符数组,其中包含当前字符串对象中的所有字符,从指定的索引开始,直到指定的长度。 34 Public Function ToLower As String公共函数ToLower As String 返回此字符串的转换为小写的副本。 35 Public Function ToUpper As String公共函数ToUpper As String 返回此字符串的转换为大写的副本。 36 Public Function Trim As String公共函数Trim As String 从当前String对象中删除所有前导和尾部空格字符。 上面列出的方法并不详尽,请访问MSDN库获取完整的方法列表和String类构造函数。 例子: 下面的例子说明了上述一些方法: 比较字符串: Module strings Sub Main() Dim str1, str2 As String str1 = "This is test" str2 = "This is text" If (String.Compare(str1, str2) = 0) Then Console.WriteLine(str1 + " and " + str2 + " are equal.") Else Console.WriteLine(str1 + " and " + str2 + " are not equal.") End If Console.ReadLine() End SubEnd Module当上述代码被编译和执行时,它产生了以下结果: This is test and This is text are not equal. 字符串包含字符串: Module strings Sub Main() Dim str1 As String str1 = "This is test" If (str1.Contains("test")) Then Console.WriteLine("The sequence 'test' was found.") End If Console.ReadLine() End SubEnd Module当上述代码被编译和执行时,它产生了以下结果: The sequence 'test' was found. 获取的子字符串: Module strings Sub Main() Dim str As String str = "Last night I dreamt of San Pedro" Console.WriteLine(str) Dim substr As String = str.Substring(23) Console.WriteLine(substr) Console.ReadLine() End SubEnd Module当上述代码被编译和执行时,

上一页  [1] [2] [3]  下一页


VB.Net - 字符串