Results 1 to 8 of 8

Thread: Delete the text

  1. #1

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    79

    Delete the text

    How to delete the text between "<>" and "<>" if the text length is less 30 characters?
    For example text contains:

    <>Home<>
    <>U.S.<>
    <>World<>
    <>Politics<>
    <>Business<>

    <>Health<>
    <>SciTech<>
    <>Entertainment<>

    <>Virgin Galactic is offering tickets aboard SpaceShipTwo spaceliners for an initial price of about $200,000, though Branson said the cost is expected to drop after the first five years of operations.<>

    <>The space tourism firm plans to eventual launch flights out of a terminal at New Mexico's Spaceport America, with additional trips through the aurora borealis to be staged from Kiruna, Sweden.<>

  2. #2
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Delete the text

    Where is this text coming from and does the text length mean the text between the <> or including ?

    Casey.

  3. #3

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    79

    Re: Delete the text

    text length means the text between.

  4. #4
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    UK
    Posts
    285

    Re: Delete the text

    AlexVorn: I think you may be over-thinking the problem, as a dead-simple solution would be:
    vb.net Code:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    2.         Dim p() As String = New String() _
    3.             {"<>Home<>", "<>U.S.<>", "<>World<>", "<>Politics<>", "<>Business<>", "<>Health<>", _
    4.             "<>SciTech<>", "<>Entertainment<>", _
    5.             "<>Virgin Galactic is offering tickets aboard SpaceShipTwo spaceliners for an initial price of about $200,000, though Branson said the cost is expected to drop after the first five years of operations.<>", _
    6.             "<>The space tourism firm plans to eventual launch flights out of a terminal at New Mexico's Spaceport America, with additional trips through the aurora borealis to be staged from Kiruna, Sweden.<>"}
    7.         For i As Int32 = 0 To p.Length - 1
    8.             If p(i).Length < 34 Then p(i) = "<><>"
    9.             textbox1.AppendText(p(i) & vbNewLine)
    10.         Next
    11.     End Sub
    Also, vbasicgirl's question is legitimate; is part of your problem how to get scan through a mass of text, or (as I have assumed) are the strings already in an array?

  5. #5

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    79

    Re: Delete the text

    @bigMeUp
    Some Syntax errors are displaying! I cant debug the code.

  6. #6
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    UK
    Posts
    285

    Re: Delete the text

    What are the syntax errors?

  7. #7

    Thread Starter
    Banned
    Join Date
    Jan 2008
    Posts
    79

    Re: Delete the text


  8. #8
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    UK
    Posts
    285

    Re: Delete the text

    there is no space underscore after your Dim p() As String = New String. It should be, Dim p() As String = New String() _

    Also, don't leave empty lines after each underscore (which is the line-continuation character).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width