How to remove the first occurrence of comma from a string in VB.NET

1 Answer

0 votes
Imports System

Public Class Program
	Public Shared Sub Main()
        Dim s As String = "c c++, java, python, c# vb"
		
        Dim comma As String = ","
		
        Dim index As Integer = s.IndexOf(comma)
		
        s = If((index < 0), s, s.Remove(index, comma.Length))
			
        Console.Write(s)
    End Sub
End Class
	
	

	
	
' run:
'	
' c c++ java, python, c# vb	
'

 



answered Apr 18, 2022 by avibootz

Related questions

1 answer 150 views
1 answer 145 views
1 answer 155 views
1 answer 133 views
1 answer 126 views
1 answer 124 views
1 answer 126 views
...