jagat parikh
jagat parikh

Reputation: 1

vb.net code to split string from second position delimiter

add = address.Split(",")
For count = 0 To add.Length - 1
para = New Paragraph(add(count), FontFactory.GetFont("Times New Roman", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK))
para.Alignment = Element.ALIGN_LEFT
document.Add(para)

Next

Above code split all string in new line.I want to split string when second position delimiter found

Upvotes: 0

Views: 471

Answers (2)

Suleman
Suleman

Reputation: 51

this code is working change it with you requirements

public Class Form1

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim splitchops() As String
    Dim count As Integer
    splitchops = TextBox1.Text.Split(",")

    For count = 0 To splitchops.Length - 1
      If count = 0 Then
        ListBox1.Items.Add(splitchops(count).ToString + "," + splitchops(count + 1).ToString)
      ElseIf count = 2 Then

        ListBox1.Items.Add(splitchops(count).ToString)
      End If
    Next

  End Sub
End Class

Upvotes: 0

prem
prem

Reputation: 3538

If I got your question correctly then you want the string from second position. In this case you can start your loop form 1 instead of 0.

    For count = 1 To add.Length - 1
      'Your piece of code
    Next

Upvotes: 1

Related Questions