4
In VB.NET, you can concatenate or insert a string at a specific position by using the Insert method. Since you want to insert the substring [^a-zA-Z0-9 ]% after the first word, you can find the position of the first space and insert the string at that location.
But do you really want to insert a REGEX "[^a-zA-Z0-9 ]%"?
Check the below code:
Dim s1 As String = "sustainability energy long last"
Dim insertText As String = " [^a-zA-Z0-9 ]%"
Dim firstSpaceIndex As Integer = s1.IndexOf(" ")
If firstSpaceIndex >= 0 Then
s1 = s1.Insert(firstSpaceIndex, insertText)
End If
Console.WriteLine(s1)
Accepted 1
Thank you so much Navin. ACtuaaly i need this. I was trying something. SO thank you once again.