📄 useful2.bas
字号:
Attribute VB_Name = "m_misc"
Public Function GetTime(TimerVal As Long) As String
' Returns time in HH:MM:SS format from Timer value(use 0 for current time :))
tx = Timer - TimerVal
x = Int((tx / 60) / 60)
tx = tx - (x * 60 * 60)
y = Int(tx / 60)
tx = tx - (y * 60)
z = Int(tx)
sx1$ = Trim$(Str$(x))
sy1$ = Trim$(Str$(y))
sz1$ = Trim$(Str$(z))
If Len(sx1$) = 1 Then sx1$ = "0" & sx1$
If Len(sy1$) = 1 Then sy1$ = "0" & sy1$
If Len(sz1$) = 1 Then sz1$ = "0" & sz1$
GetTime$ = sx1$ & ":" & sy1$ & ":" & sz1$
End Function
Public Function ReplBack(txt As String) As String
Dim t As Integer
Dim u As Integer
Dim temp As String
Dim rv As String * 1
t = Len(txt$)
For u = 1 To t
rv$ = Mid$(txt$, u, 1)
If rv$ = "/" Then rv$ = "\"
temp$ = temp$ & rv$
Next u
ReplBack = temp$
End Function
Public Function ReplaceStr(ByVal strMain As String, strFind As String, strReplace As String) As String
Dim lngSpot As Long, lngNewSpot As Long, strLeft As String
Dim strRight As String, strNew As String
lngSpot& = InStr(LCase(strMain$), LCase(strFind$))
lngNewSpot& = lngSpot&
Do
If lngNewSpot& > 0& Then
strLeft$ = Left(strMain$, lngNewSpot& - 1)
If lngSpot& + Len(strFind$) <= Len(strMain$) Then
strRight$ = Right(strMain$, Len(strMain$) - lngNewSpot& - Len(strFind$) + 1)
Else
strRight = ""
End If
strNew$ = strLeft$ & strReplace$ & strRight$
strMain$ = strNew$
Else
strNew$ = strMain$
End If
lngSpot& = lngNewSpot& + Len(strReplace$)
If lngSpot& > 0 Then
lngNewSpot& = InStr(lngSpot&, LCase(strMain$), LCase(strFind$))
End If
Loop Until lngNewSpot& < 1
ReplaceStr$ = strNew$
End Function
Public Function Exists(txt As String) As Integer
On Error GoTo noexist
Open txt For Input As #12
Exists = 1
Close 12
Exit Function
noexist:
Close 12
Exists = 0
End Function
Public Function RidFormatting(para As String) As String
On Error GoTo RFER
para = ReplaceStr(para, "%22", Chr$(34))
para = ReplaceStr(para, "%3C", "<")
para = ReplaceStr(para, "%3E", ">")
para = ReplaceStr(para, "+", " ")
para = ReplaceStr(para, "%0D%0A", "<br>")
para = ReplaceStr(para, "%21", "!")
para = ReplaceStr(para, "%22", """)
para = ReplaceStr(para, "%20", " ")
para = ReplaceStr(para, "%A7", "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -