Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 26th, 2006, 10:26 AM   #1
hush
Programmer
 
hush's Avatar
 
Join Date: Feb 2006
Location: 127.0.0.1
Posts: 35
Rep Power: 0 hush is on a distinguished road
strange symbol

The following code works well apart from one slight floor. I can’t seem to figure it out.

The job it is doing it essentially removing a given section of the string by splitting it up and then joining it back together again (I’m sure the process it obvious by the code).

However when it is displayed in a text box on a form it has some wired rectangle character on the last line by itself. At first I though it was the process of splinting it and putting it back together but if I comment out the line that clears the array it seems that the character disappears.

That then made me think it was the fact that an element of an array is cleared out and not removed but in changing the value of the array element to “” it still has that symbol.

What is the symbol called (a little rectangle that is tall and thin)?

Any I ideas on what’s causing it?


     'declares an array
        Dim ping_stdout_array() As String
        'splits the string 's' into lines and then passes each string into array ping_stdout_array
        ping_stdout_array = s.Split(vbLf)

        'iterates 0 - the size of the array
        For i As Integer = 0 To UBound(ping_stdout_array)
            'declares a variable type boolean
            Dim t_or_f As Boolean
            'searches each line of the array for the word "exit" and returns - true or false into 
            'the 'boolean' variable
            t_or_f = InStr(ping_stdout_array(i), "exit")
            'conditional - if true then clear array element 'i'. 1 is the number of elements to clear
            If t_or_f = "True" Then
                'Array.Clear(ping_stdout_array, i, 1)

            End If
           
        Next

        'joins the array back together and passes it back into the s variable
        s = String.Join(vbLf, ping_stdout_array)
        

        'displays stdout of ping to "textbox" on form1
        TextBox.Text = s
hush is offline   Reply With Quote
Old Aug 26th, 2006, 10:37 AM   #2
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 850
Rep Power: 4 The Dark is on a distinguished road
I think the multiline edit control needs a CR-LF sequence for the end of lines.
Try using vbCrLf in your join statement.
The Dark is offline   Reply With Quote
Old Aug 26th, 2006, 10:44 AM   #3
hush
Programmer
 
hush's Avatar
 
Join Date: Feb 2006
Location: 127.0.0.1
Posts: 35
Rep Power: 0 hush is on a distinguished road
It got rid of the symbol at the end of the string. But put one at the end of each line.

I guess that’s the sysmbol for Cr (carriage return) then.

Thanks for the swift reply
hush is offline   Reply With Quote
Old Aug 26th, 2006, 10:47 AM   #4
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 850
Rep Power: 4 The Dark is on a distinguished road
Quote:
Originally Posted by hush
It got rid of the symbol at the end of the string. But put one at the end of each line.

I guess that’s the sysmbol for Cr (carriage return) then.

Thanks for the swift reply
You should change the vbLf in the split line too.
Otherwise you would be leaving the original CRs in the strings after splitting, which would give your two CRs and one LF when you joined them back again.
The Dark is offline   Reply With Quote
Old Aug 26th, 2006, 12:35 PM   #5
hush
Programmer
 
hush's Avatar
 
Join Date: Feb 2006
Location: 127.0.0.1
Posts: 35
Rep Power: 0 hush is on a distinguished road
That puts three of them next to each other on a new line.

But I then tried every combination as I see what you are getting at and I found one that works properly:

ping_stdout_array = s.Split(vbCrLf)



s = String.Join(vbCr, ping_stdout_array)

thanks for the help The Dark
hush is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd compile Error. Need help please. Keiyentai Java 7 Aug 19th, 2006 1:35 AM
C++ OWL What am I doing wrong Vagabond C++ 7 Mar 24th, 2006 5:31 PM
Problem Compiling this program OUfanAP12 Java 4 Nov 7th, 2005 7:27 PM
inserting symbol into a string Bernard C 26 Aug 2nd, 2005 3:30 AM
Errors in microjava midlet freddielj Java 1 Apr 8th, 2005 11:02 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:17 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC