Splitting / Parsing help in .net

Discussion in 'Programming General' started by Covey, Oct 13, 2009.

Splitting / Parsing help in .net
  1. Unread #1 - Oct 13, 2009 at 7:30 AM
  2. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Splitting / Parsing help in .net

    Ok i need would like to know the proper way to manipulate strings.

    I'm trying to convert this:
    "C:\Stuff\Music\Disturbed\01-blah.mp3"
    to
    "C:\Stuff\Music\Disturbed\"

    How do i go about doing this, i messed with mid, instr, instrrev and seem to fail.....

    This is the current code if it helps:
    Code:
        For Each strPath In strFileCount
            intChrCount = InStrRev(strPath, "\")
            str = Mid(strPath, 1, Len(strPath) - intChrCount)
            MsgBox(str)
        Next
     
  3. Unread #2 - Oct 13, 2009 at 9:27 AM
  4. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    Splitting / Parsing help in .net

    Just split it with "\" and then just put it all back together minus the last piece? I don't know how to do it in .net but its pretty simple in java...
     
  5. Unread #3 - Oct 13, 2009 at 5:38 PM
  6. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Splitting / Parsing help in .net

    Code:
            Dim Path As String = "path\to\file\file.type"
            If (Path.Contains("\")) Then
                Path = Path.Remove(Path.LastIndexOf("\"))
            End If
    String.Remove() Removes all the characters in a string from a specified index, up until either the end or the specified length. String.LastIndexOf() should be fairly obvious.

    For more info on the String class, see here:
    http://msdn.microsoft.com/en-au/library/system.string.aspx
     
  7. Unread #4 - Oct 13, 2009 at 8:25 PM
  8. Hey321
    Joined:
    Jul 30, 2007
    Posts:
    503
    Referrals:
    0
    Sythe Gold:
    0

    Hey321 Forum Addict

    Splitting / Parsing help in .net

    Sorry for hijacking your thread, hope you don't mind.

    I'm trying to pull some text off a webpage (for example, if I want to find HAUUU~ in your signature, Swan, I'd have to parse this (you probably already know this, but I'm putting it out there for the benefit of people who don't):

    Code:
    <font color="Red"><b>HAUUU~~ (Click above)</b></font></a></div>
    And grab the text between the <b> and </b>.

    Assuming that the text I need to find is wrapped by unique HTML codes, how would I go about extracting the text? I've tried using a pos() check on both, and grabbing the substring from the start position to the end position, but unfortunately, this does not seem to work.

    ~Sandstorm
     
< Sprry! Didn't know where to put this! (I need scripting help!) | Looking for people who can make programs using MySQL >

Users viewing this thread
1 guest


 
 
Adblock breaks this site