Results 1 to 6 of 6

Thread: [RESOLVED] String.Split with Enters and Tabs

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    384

    Resolved [RESOLVED] String.Split with Enters and Tabs

    Hello.

    I'm getting information from the CLipboard that looks like the attached picture.

    As you can see, there are 2 columns.

    I'd like to be able to split each column into a separate array. This is what I have tried :

    Code:
            Dim iData As IDataObject = New DataObject
            iData = Clipboard.GetDataObject()
    
            If iData.GetDataPresent(DataFormats.Text) Then
    
                strClipText = iData.GetData(DataFormats.Text, True).ToString().Split(Environment.NewLine.ToCharArray())
    
    
                For iCounter = 0 To strClipText.Length - 1
                    strClipText(iCounter) = strLeft(strClipText(iCounter), 5)
                    strClipText(iCounter) = Trim(strClipText(iCounter))
    
                Next
            End If
    
        Public Function strLeft(ByVal param As String, ByVal length As Integer) As String
    
            'we start at 0 since we want to get the characters starting from the
            'left and with the specified lenght and assign it to a variable
            Dim result As String
            If IsNumeric(param) Then result = Trim(param.Substring(0, length))
    
            'return the result of the operation
            Return result
    
        End Function
    The problem with this is that I still get the entire row, instead of the first 5 characters of the row. I'd also like to know if it is possible to not include empty spaces - such as the first row??

    Any help would be appreciated.
    Attached Images Attached Images  

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