<% ' Copyright (C) 1998-2005 Cyberstrong Internet Services, Inc. All Rights Reserved ' ' This file has been seeded with unique information at point of sale and ' is traceable to its purchaser. ' ' Your license agreement forbids the removal of this notice. ' strings.asp - Additional string support Const MaxOpenScans = 25 ' Maximum number of strings we can scan at once Dim i ' Temporary loop counter Dim ScanString(100) ' The string we are scanning Dim ScanPosition(100) ' Our current scan position in ScanString() ' Initialize scan storage ... For i = 1 To MaxOpenScans Step 1 ScanPosition(i) = 0 ScanString(i) = "" Next ' OpenScanB() - Open a string for subsequent scanning ... Public Function OpenScanB(ByVal argScanString) Dim i i = 1 Do While (ScanPosition(i) <> 0) If (i > MaxOpenScans) Then OpenScanB = 0 Exit Function End If i = i + 1 Loop ScanString(i) = argScanString ScanPosition(i) = 1 OpenScanB = i End Function ' BreakStrB() - Break to the givin string in the currently open scan string ' or end if given string is null. Public Function BreakStrB(ByVal argScanIndex, ByVal argBreakOnString) Dim StartPos, EndPos StartPos = ScanPosition(argScanIndex) If (argBreakOnString <> "") Then EndPos = InStrB(StartPos, ScanString(argScanIndex), argBreakOnString) Else EndPos = LenB(ScanString(argScanIndex)) + 1 End If ' If we can't find this string, don't move the pointer ... If (EndPos > 0) Then BreakStrB = MidB(ScanString(argScanIndex), StartPos, EndPos - StartPos) ScanPosition(argScanIndex) = EndPos Else BreakStrB = "" End If ' For debug only ... ' wl("
BreakStrB Seeking: '" & StrToAsc(BinToStr(argBreakOnString)) & "' Returning: '" & Left(StrToAsc(BinToStr(BreakStrB)), 25) & "' StartPos: " & StartPos & " EndPos: " & EndPos & " Length: " & LenB(BreakStrB) & "
") End Function ' CloseScanB() - Close the give scan string Public Sub CloseScanB(ByVal argScanIndex) ScanPosition(argScanIndex) = 0 End Sub ' SpanCharsB() - Move the scan pointer forward this many chars Public Function SpanCharsB(ByVal argScanIndex, ByVal argSpanChars) Dim StartPos, EndPos StartPos = ScanPosition(argScanIndex) EndPos = StartPos + argSpanChars ScanPosition(argScanIndex) = EndPos SpanCharsB = MidB(ScanString(argScanIndex), StartPos, EndPos - StartPos) End Function 'StrToBin - Convert a string to binary string Public Function StrToBin(ByVal argString) Dim i, Char For i = 1 to Len(argString) Char = Mid(argString, i, 1) StrToBin = StrToBin & chrB(AscB(Char)) Next End Function ' BinToStr - Convert a binary string to string Function BinToStr(ByVal argBinary) Dim i, s For i = 1 To LenB(argBinary) s = s & Chr(AscB(MidB(argBinary, i, 1))) Next BinToStr = s End Function ' StrToAsc - Convert a strng to ascii Function StrToAsc(ByVal argString) Dim i, c, s For i = 1 To Len(argString) c = Mid(argString, i, 1) if ((c >= " ") AND (c <= "z")) Then s = s & c Else s = s & "[" & Asc(c) & "]" End If Next StrToAsc = s End Function %>