How to get the length of every word in array of strings using Linq in VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq

Public Class Program
	Public Shared Sub Main()
        Dim array As String() = {"c sharp", "c", "c++", "java", "python"}
		
        Dim wordsLength = array.Select(Function(e) e.Length)
        
		Console.WriteLine(String.Join(", ", wordsLength))
    End Sub
End Class

	
	
	
' run:
'
' 7, 1, 3, 4, 6
'

 



answered Jul 8, 2023 by avibootz
...