newman     VBWeb     VBSource     Portfolio    
OUT ON THE INTERNET


Home

Getting Started
- Hello World Example
- SampleMain Example
- Code Snippets
- Request Collection
- Missing Terms
- Multi-Select
- Names Collection

User Guide
- Debugging
- Stepping Through Code
- HTML Templates
- Cookies

Command Reference
- AddToRequest
- BackupRequest
- CgiDebugPrint
- ErrorHandler
- Escape
- Extract
- FileContents
- FileExists
- GetRequest
- GmtDate
- IsVBIDE
- LoadRequest
- Parse
- Redirect
- Replace
- Send
- SendLn
- ServerVariables
- SetCookie
- StandardIn
- UrlDecode
- UrlEncode

Appendix
- Web Server Directory Mapping
- Computer Name & IP Address

Reference - Extract
Returns the text in rTextIn that is between the two placeholders, Front and Back. Then it removes Front, Back, and the text returned from rTextIn.
Syntax
TextOut = Extract(rTextIn, Front, Back)
Part
Description
rTextIn Required text that contains Front, Back, and the text to be extracted. Note that its value changes since Front, Back, and the text between them get removed.
Front Required text that can be found rTextIn. The place where Front is found in rTextIn marks the beginning of the text returned by the function.
Back Required text that can be found rTextIn somewhere after Front. The place where Back is found in rTextIn following Front marks the end of the text returned by the function.

Remarks
The result returned does not include Front and Back even though they get removed from rTextIn. Front must come before Back in rTextIn. If Front is not unique in rTextIn, then the result starts after the first occurrence. If Back is not unique in the text that follows Front, then the result ends before the first occurrence that follows Front. If either Front is not found or no Back is found following Front, then nothing is returned and rTextIn is not changed.

Notice that the value of rTextIn changes. (It's passed by reference.) Front, Back, and the text returned get removed from rTextIn. This behavior is intentional for use with HTML templates. You can use this function to get SQL or record level templates out of an HTML template. This is not the kind of text you want your visitors seeing. That's why this function removes it. In addition, you don't need to wrap the embedded text up in something HTML friendly like comment tags.

To embed such text in a template, be sure to put delimiters around it. When you call this function to extract that text, You should put the delimiters in the Front and Back arguments.

Although this function is intended for use with HTML Templates, it is general enough to be used elsewhere. More examples of using this function with HTML templates are in the User Guide.

Example
The following pops up True twice. Template = "<HTML>" _ & "[SQL: SELECT * FROM Employee]" _ & "</HTML>" Sql = Extract(Template, "[SQL: ", "]") If Template = "<HTML></HTML>" Then MsgBox "True" End If If Sql = "SELECT * FROM Employee" Then MsgBox "True" End If


Copyright 1997 NEWMAN Services Corp. All rights reserved.
973-228-5753 pres@newmanservices.com