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

    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:
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <player showDisplay="yes" showPlaylist="yes" autoStart="yes">
      <song path="" title="song title" /> 
      <song path="" title="song title 2" /> 
    Last edited by mehran; 04-25-06 at 19:34.

  2. #2
    Join Date
    Jun 2004
    Arizona, USA
    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.
    "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