www.webdeveloper.com
Results 1 to 6 of 6

Thread: Using split() command

  1. #1
    Join Date
    Jun 2005
    Posts
    178

    Using split() command

    Hi

    I got more of a question rather than that of a problem (Although a problem too)

    Basically i have a sentence (String) that is in questionin and need to split it into single words so i need to remove all of the ,.""'';:!&^?/\ spaces etc.

    when use this function it seems to slightly work
    Textdelimiter = /<[^>]*>/g removing all of the brackets etc but not full stops.

    I know it is a regular expression but thought i could add to it eg full stop question marks all the things that must be removed to leave pure strings of words.

    So when I add this it goes pair shape

    Textdelimiter = /.,?\|&+-~#{}<[^>]*>/g
    questionOut = Split(questionin,textdelimiter)

    So basically I am just asking if either I need to add it a certain way or is there a different way of securing what i am trying to achieve?

    Thanks for any help
    NEW RIG

    Asus deluxe sli mobo
    4000+ amd 64 (clocked at 2.6)
    1gb corsair xms pro
    200gb seagate
    xfx 7800gtx
    windows 64 (quick fix on driver pm for how)

  2. #2
    Join Date
    Sep 2004
    Location
    Northeast, FL
    Posts
    332
    How about something like this?
    Code:
    Dim x As String = "asdf 3434 asd /.,/2asfas"
    Dim y As String
    Dim z As New ArrayList
    For Each C As Char In x.ToCharArray
        If Char.IsLetterOrDigit(C) Then
            y &= C
        Else
            If y <> "" Then
                z.Add(y)
                y = ""
            End If
        End If
    Next
    If y <> "" Then z.Add(y)
    Dim arr As String() = z.ToArray(GetType(String))

  3. #3
    Join Date
    Jun 2005
    Posts
    178
    Im really sorry but kind of new to all of this and just wonder if you could explain what this is doing.

    basically i am taking an xml in like the Battery (B3EE) is over heating and exploding.

    i need to get rid of all of the ().,;:/\|?{}[]()*&^%""! etc.

    I am gathering the above is handled by string x....am i right.and c is the input variable that i get from xml.

    Is this correct.
    NEW RIG

    Asus deluxe sli mobo
    4000+ amd 64 (clocked at 2.6)
    1gb corsair xms pro
    200gb seagate
    xfx 7800gtx
    windows 64 (quick fix on driver pm for how)

  4. #4
    Join Date
    Oct 2005
    Location
    NYC
    Posts
    108
    in that above code.

    x will be the word you are searching.

    and c is each character within x.

    it is examing each c within x character by character. if c is a valid character or number, then dump it into a new string...

    -Tak

  5. #5
    Join Date
    Sep 2004
    Location
    Northeast, FL
    Posts
    332
    Exactly, it is basically creating an array of words composed strictly of letters and digits. For the example, the following array of words is created: "asdf","3434","asd","2asfas".

  6. #6
    Join Date
    Jun 2005
    Posts
    178
    ahh k thanks it late but i will try it tomo and see if that does it thanks again.

    On a side note will this effect the output of words like don't etc?
    NEW RIG

    Asus deluxe sli mobo
    4000+ amd 64 (clocked at 2.6)
    1gb corsair xms pro
    200gb seagate
    xfx 7800gtx
    windows 64 (quick fix on driver pm for how)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles