?? inc_inifile_func.asp
字號:
<%
Set InIfileDictionary = CreateObject("Scripting.Dictionary")
Sub InIfileLoad(ByVal FilSpc)
InIfileDictionary.RemoveAll
FilSpc = FilSpc
If left(FilSpc, 1) = "p" Then
'Physical path
PhyPth = mid(FilSpc, instr(FilSpc, "=") + 1)
Else
'Virtual path
PhyPth = Server.MapPath(mid(FilSpc, instr(FilSpc, "=") + 1))
End If
Set FilSys = CreateObject("Scripting.FileSystemObject")
Set InIfil = FilSys.OpenTextFile(PhyPth, 1)
Do While Not InIfil.AtEnDofStream
StrBuf = InIfil.ReadLine
If StrBuf <> "" Then
'There is data on this line
If left(StrBuf, 1) <> ";" Then
'It's Not a comment
If left(StrBuf, 1) = "[" Then
'It's a section header
HdrBuf = mid(StrBuf, 2, len(StrBuf) - 2)
Else
'It's a value
StrPtr = instr(StrBuf, "=")
AltBuf = HdrBuf & "|" & left(StrBuf, StrPtr - 1)
Do While InIfileDictionary.Exists(AltBuf)
AltBuf = AltBuf & "_"
Loop
InIfileDictionary.Add AltBuf, mid(StrBuf, StrPtr + 1)
End If
End If
End If
Loop
InIfil.Close
Set InIfil = Nothing
Set FilSys = Nothing
End Sub
Function InIfileValue(ByVal ValSpc)
Dim Ifarray
Dim i
StrPtr = instr(ValSpc, "|")
ValSpc = ValSpc
If StrPtr = 0 Then
'They want the whole section
StrBuf = ""
StrPtr = len(ValSpc) + 1
ValSpc = ValSpc + "|"
Ifarray = InIfileDictionary.Keys
For i = 0 to InIfileDictionary.Count - 1
If left(Ifarray(i), StrPtr) = ValSpc Then
'This is from the section
If StrBuf <> "" Then
StrBuf = StrBuf & "~"
End If
StrBuf = StrBuf & Ifarray(i) & "=" & InIfileDictionary(Ifarray(i))
End If
Next
Else
'They want a specIfic value
StrBuf = InIfileDictionary(ValSpc)
End If
InIfileValue = StrBuf
End Function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -