0

Visual Basic を使用して、文字列内のテキストを別の文字列に置き換えたいと考えています。文字列内のこのテキストの場所がわかりません。どうすればこれを達成できますか?

助けてくれてありがとう。

4

2 に答える 2

3

試す:

X = X.Replace("original"," toReplace")

またはこのリンク:

Imports System.Text.RegularExpressions

Module Module1
    Sub Main()
    ' Input string.
    Dim input As String = "Dot Net Not Perls"
    ' Use Regex.Replace with string arguments.
    Dim output As String = Regex.Replace(input, "N.t", "NET")
    ' Print.
    Console.WriteLine(input)
    Console.WriteLine(output)
    End Sub
End Module

Output

Dot Net Not Perls
Dot NET NET Perls
于 2013-09-11T23:28:50.830 に答える
-1

replace メソッドでは、場所を知る必要はありません。元の値、検索する文字列、およびそれを変更する文字列も指定します。非常に簡単です。

Dim aString As String = Replace("String to Search", "String to Find", "String to Replace With")
于 2013-09-11T23:29:55.030 に答える