vb System.String.Replace类(方法)实例源码

下面列出了vb System.String.Replace 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:Syste   
Module Example
   Public Sub Main()
      Dim s As String = "aaa"
      Console.WriteLine("The initial string: '{0}'", s)
      s = s.Replace("a", "b").Replace("b", "c").Replace("c", "d")
      Console.WriteLine("The final string: '{0}'", s)
   End Sub
End Module

作者:VB.NET开发    项目:Syste   
Class stringReplace1
   Public Shared Sub Main()
      Dim str As [String] = "1 2 3 4 5 6 7 8 9"
      Console.WriteLine("Original string: ""{0}""", str)
      Console.WriteLine("CSV string:      ""{0}""", str.Replace(" "c, ","c))
   End Sub
End Class

作者:VB.NET开发    项目:Syste   
Module Example
   Public Sub Main()
      Dim s As New String("a"c, 3)
      Console.WriteLine("The initial string: '{0}'", s)
      s = s.Replace("a"c, "b"c).Replace("b"c, "c"c).Replace("c"c, "d"c)
      Console.WriteLine("The final string: '{0}'", s)
   End Sub
End Module

作者:VB.NET开发    项目:Syste   
Public Class ReplaceTest
    
    Public Shared Sub Main()
        Dim errString As String = "This docment uses 3 other docments to docment the docmentation"
                
        Console.WriteLine("The original string is:{0}'{1}'{0}", Environment.NewLine, errString)

        ' Correct the spelling of "document".  
        Dim correctString As String = errString.Replace("docment", "document")
      
        Console.WriteLine("After correcting the string, the result is:{0}'{1}'", Environment.NewLine, correctString)
    End Sub
End Class

作者:VB程序    项目:Syste   
' 导入命名空间
Imports System

Public Class MainClass
    Shared Sub Main()
        'Declare variables
        Dim strData As String
        Dim strNewData As String

        'Get the text from the TextBox
        strData = "Hello You"

        'Replace the string occurance
        strNewData = strData.Replace("Hello", "Goodbye")

        'Display the new string
        System.Console.WriteLine(strNewData)
    End Sub

End Class


问题


面经


文章

微信
公众号

扫码关注公众号