Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2003, 11:54 AM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default I dont understand what this program does?

iPos = InStr(1,strContents,"<!--TITLE:")
If iPos = 0 then
  strTitle = "Untitled (" & objFile.Name & ")"
  strDesc = ""
Else
  strTitle = Mid(strContents,iPos+10,InStr(iPos,strContents,"-->")-iPos-10)
iPos = InStr(iPos,strContents,"<!--DESC:")
If iPos = 0 then
  strDesc = ""
Else
strDesc = Mid(strContents,iPos+9,InStr(iPos,strContents,"-->")-iPos-9)
End If
End If

My question is i dont really know what this program is doing? Can anyone explain this for me? And what does it mean by -ipos-9 ????
confused..

 
Old September 9th, 2003, 12:45 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This take a string and try to extract some information from it

Let assume that strContents containt:
"Some text""

'Find the prosition of the string "<!--TITLE:" from the Start.
'iPos will be equal to 14
iPos = InStr(1,strContents,"<!--TITLE:")

'Verify that the string "<!--TITLE:" was found
If iPos = 0 then
    'In case no found
    strTitle = "Untitled (" & objFile.Name & ")"
    strDesc = ""
Else
    'Extract the value of title.
    'iPos+10 is the next character after the string "<!--TITLE:".
    'Start after the string until it find the string "-->".
    'It will return "The Title"
    strTitle = Mid(strContents,iPos+10,InStr(iPos,strContents,"-->")-iPos-10)

    'Find the prosition of the string "<!--DESC:"
    'from the position of the string "<!--TITLE:"
    'iPos will be equal to 45
    iPos = InStr(iPos,strContents,"<!--DESC:")

    'Verify that the string "<!--DESC:" was found
    If iPos = 0 then
        strDesc = ""
    Else
        'Extract the value of Desc.
        'iPos+9 is the next character after the string "<!--DESC:".
        'Start after the string until it find the string "-->".
        'It will return "The description"
        strDesc = Mid(strContents,iPos+9,InStr(iPos,strContents,"-->")-iPos-9)
    End If
End If

Stéphane Lajoie
 
Old September 9th, 2003, 01:21 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your help =D !!!!!!!!







Similar Threads
Thread Thread Starter Forum Replies Last Post
I dont know what the topic is?! Apocolypse2005 Beginning VB 6 3 August 20th, 2007 12:44 PM
I don't understand... jmsherry ASP.NET 2.0 Basics 17 July 23rd, 2007 12:28 PM
I still do not understand aude_poullain ASP.NET 1.0 and 1.1 Basics 2 February 7th, 2007 09:11 PM
Who can understand this book? HandSomeLi All Other Wrox Books 2 October 20th, 2004 04:12 PM
i can't understand this error! ion Classic ASP Databases 2 September 23rd, 2003 03:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.