Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Posts
    203

    Arrow Unanswered: How to extract certain data patterns from textbox input?

    Hi all .i got the following inside a textbox inside my vb6 form. I am looking for a way to ripp the song path and title from it and use them and insert them to mysql datbase. But i do not know how to ripp those part
    i be happy that an expert tell me how i can do it using vb6. The number of song path are not know in before and the parts
    that i want to write to mysql are shown in bold.Thanks


    data inside my texbox:
    Code:
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <player showDisplay="yes" showPlaylist="yes" autoStart="yes">
      <song path="http://www.mysite.com/TtdlI3l1lIl0OOO0a/singer1/album1/song1.mp3" title="song title" /> 
      <song path="http://www.mysite.com/TtdlI3l1lIl0OOO0a/singer1/album1/songname2.mp3" title="song title 2" /> 
      
      </player>
    Last edited by mehran; 04-25-06 at 19:34.

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    The INSTR function returns the position of a string within another string. So, your first task is to use INSTR to find the position of "song path =", and add 10 to this. This will be the starting point of your first file.

    Then, use INSTR again to find the position of the first instance of ".mp3" AFTER the prior point, and add 4 to that.

    Now that you have the starting and ending points, use the MID function to copy the substring to a string variable & save the variable into your database.

    Note that the INSTR function has an optional parameter which defines the starting point where it should begin searching. So, on the first use of instr, start at position 1. On the next instance, start at the position that you previously calculated as the starting point of the song file name.

    Then, repeat until instr returns a value of zero, which means that it couldn't find a match.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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