|
-
Jan 23rd, 2008, 06:17 PM
#1
Thread Starter
Banned
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.<>
-
Jan 23rd, 2008, 06:30 PM
#2
Re: Delete the text
Where is this text coming from and does the text length mean the text between the <> or including ?
Casey.
-
Jan 23rd, 2008, 07:13 PM
#3
Thread Starter
Banned
Re: Delete the text
text length means the text between.
-
Jan 23rd, 2008, 07:15 PM
#4
Hyperactive Member
Re: Delete the text
AlexVorn: I think you may be over-thinking the problem, as a dead-simple solution would be:
vb.net Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim p() As String = New String() _
{"<>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.<>"}
For i As Int32 = 0 To p.Length - 1
If p(i).Length < 34 Then p(i) = "<><>"
textbox1.AppendText(p(i) & vbNewLine)
Next
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?
-
Jan 23rd, 2008, 07:41 PM
#5
Thread Starter
Banned
Re: Delete the text
@bigMeUp
Some Syntax errors are displaying! I cant debug the code.
-
Jan 23rd, 2008, 07:48 PM
#6
Hyperactive Member
Re: Delete the text
What are the syntax errors?
-
Jan 23rd, 2008, 07:52 PM
#7
Thread Starter
Banned
-
Jan 23rd, 2008, 07:57 PM
#8
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|