How to split a string into 2 different substrings in VB.NET

1 Answer

0 votes
Imports System

Public Class Program
   	Public Shared Sub Main(ByVal args As String())
        Dim str As String = "AlbusDumbledore"
		Dim size as Integer = 5

		Dim first As String = str.Substring(0, size)
		Dim second As String = str.Substring(size, str.Length - size)

		Console.WriteLine(first)
        Console.Write(second)

    End Sub
End Class



' run:
'
' Albus
' Dumbledore
'

 



answered Feb 15, 2024 by avibootz
...