Split string into specific length

Split string into specific length

Solution:

Here split of 10 character length,
Try this code
  Dim LongString As String = "Roundsadecimalvaluetoaspecifiednumberoffractionaldigits."
        Dim longlist As New List(Of String)
        For j As Integer = 0 To Math.Ceiling(LongString.Length / 10 - 1)
            If LongString.Substring(j * 10).Length >= 10 Then
                longlist.Add(LongString.Substring(j * 10, 10))
            Else
                longlist.Add(LongString.Substring(j * 10))
            End If
        Next
        For Each s As String In longlist
            
        Next
Result:

Post a Comment

0 Comments