How to get intersection of two strings in VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq

Class Program
    Public Shared Sub Main()
        Dim str1 As String = "php"
        Dim str2 As String = "python"
		
        Dim intersection = New String(str1.Intersect(str2).ToArray())
		
        Console.WriteLine($"Intersection: {intersection}")
    End Sub
End Class



' run:
'
' Intersection: ph
'

 



answered Jul 6, 2025 by avibootz
...