Results 1 to 2 of 2

Thread: how to isolate a string within a strinig

  1. #1

    Thread Starter
    Hyperactive Member bsw2112's Avatar
    Join Date
    Nov 2001
    Location
    ottawa, canada
    Posts
    292

    how to isolate a string within a strinig

    I have this string

    <META name="Category_Id" content="01">

    that i store in variable strLineOfText


    i was wondering what is the best to isolate the 01 part
    i need to append this to a querystring.. (the number varies in length..ie 5624 or 1 etc..

    i was able to do it but I hope to find a more efficient way of doing this.

    here is my method that I use right now

    Code:
    ' from a file i get
    
            strLineOfText = objTS.ReadLine
    
            str1 = InStr(1,strLineOfText,"Category_Id",1) 
            
            if str1 <> 0 then
    	str2 = InStr(1,strLineOfText,"content=",1)
    	if str2 <> 0 then
    	    idNum = Mid(strLineOfText,35,Len(strLineOfText)-36)
    	end if
            end if
    
    ' then i append variable idNum to my path...
    first i need to see if i have the right line and i do that by
    looking for substring ,"Category_Id"

    then i isolate the number part..

    the string will always be the same until the number part
    that's why i start at 35


    it this the right way of doing this?
    what can i do to make this better?


    bsw

  2. #2

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