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 245 views
1 answer 257 views
1 answer 250 views
1 answer 228 views
1 answer 224 views
1 answer 216 views
1 answer 212 views
...