ASP FAQs and Answers (7)

Source: Internet
Author: User
1. Classification: Grammar Application
Problem Description: Find the number of characters between two string occurrences
Solution:
function Findstringtimes (strcontent,start_string,end_string) ' start_string and end_string number of characters out of time
' Written by Jaron
Findstringtimes = UBound (Split (strcontent,start_string))
End Function
Example: Find out how many pictures are in the following string
Response.Write Findstringtimes (HTML, "
2. The function of traversing the directory and the files in the directory
<%
function Bianli (path)
Set Fso=server. CreateObject ("Scripting.FileSystemObject")
On Error Resume Next
Set OBJFOLDER=FSO. GetFolder (PATH)
Set Objsubfolders=objfolder.subfolders
For each objsubfolder in Objsubfolders
Nowpath=path + "" + objsubfolder.name
Response.Write Nowpath
Set Objfiles=objsubfolder.files
For each objfile in Objfiles
Response.Write "<br/>---"
Response.Write Objfile.name
Next
Response.Write "<p>"
Bianli (Nowpath) ' Recursive
Next
Set objfolder=nothing
Set objsubfolders=nothing
Set fso=nothing
End Function
%>
<%
Bianli ("D:") ' Traverse D: Disk
%>
3. Generate a repeat number
Sub Calcapiao ()
Dim Strcaipiaonoarr () as String
Dim strSQL as String
Dim Strcaipiaono as String
Strcaipiaono = " 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33 "
Dim Strtemparr (7) as String
Dim Strzhongjiangarr (7) as String
Strcaipiaonoarr = Split (Strcaipiaono, ",")
Dim Intrand as Integer
Dim I as Integer
Dim J as Integer
i = 0
Dim Find as Boolean
Do While True
Find = False
Randomize
Intrand = Int ((Rnd) + 1)
For j = 0 to I-1
If Strtemparr (j) = CStr (Intrand) Then

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.