the following code shows invalid qualifier when executed
Dim strs As String
Dim insStr As String
Dim strRes As String
strs = "This is VB.NET Test"
insStr = "Insert"
strRes = strs.Insert(insStr)
Thanks in advance
the following code shows invalid qualifier when executed
Dim strs As String
Dim insStr As String
Dim strRes As String
strs = "This is VB.NET Test"
insStr = "Insert"
strRes = strs.Insert(insStr)
Thanks in advance
If you look at the signature of String.Insert
, you can see it takes two parameters. You have only supplied one. You need to specify what place to insert the second string into:
Dim strs As String
Dim insStr As String
Dim strRes As String
Dim index As Integer = 0
strs = "This is VB.NET Test"
insStr = "Insert"
strRes = strs.Insert(index, insStr)
'strRes = "InsertThis is VB.NET Test"
You forgot to say where in the string it should be inserted.
strRes = strs.Insert(strs.Length \ 2, insStr)