O
O'Donnell Tribunal
Hello,
I am trying to alter a text string to create a valid boolean query for
an index server search.
At the moment because the text string is created using combo boxes it
can have 2 or more 'AND's in succession.
Like This (strInput):
"Company AND Credit AND AND London AND AND Richmond Short Term AND AND
Intercompany AND Investment Bank AND Covertible AND AND "
what I want to do is change the above string to (strOutput2):
"Company AND Credit AND London AND Richmond AND Short Term AND
Intercompany AND Investment Bank AND Covertible"
I am trying to do it with the code below:
However this code produces problems as I loop through the various
search items.
It works fine in VB but fails when I try to port it to ASP.
If anyone has any ideas on how to fix this code, or alternative
suggestions, I would be most grateful.
Best Regards
O'Donnell Abu
CODE BELOW
<%
Dim strInput, strOutput, strOutput2 , bytLen , bytSW, i, ii
strInput = "Company AND Credit AND AND London AND AND Richmond Short
Term AND AND Intercompany AND Investment Bank AND Covertible AND AND "
bytLen = Len(strInput)
bytSW = 0
For i = 1 To bytLen
If bytSW > 0 Then
If bytSW = 1 Then
bytSW = 0
End If
If bytSW = 2 Then
bytSW = 1
End If
If bytSW = 3 Then
bytSW = 2
End If
If bytSW = 4 Then
bytSW = 3
End If
End If
If Mid(strInput, i, 3) = "AND" Then
If Mid(strInput, i, 7) = "AND AND" Then
bytSW = 4
If bytSW = 1 Then
bytSW = 0
End If
If bytSW = 2 Then
bytSW = 1
End If
If bytSW = 3 Then
bytSW = 2
End If
If bytSW = 4 Then
bytSW = 3
End If
End If
End If
strOutput = strOutput & Mid(strInput, i, 1)
Next i
If Right(strOutput, 4) = "AND " Then
ii = Len(strOutput)
ii = (ii - 4)
For i = 1 To ii
strOutput2 = strOutput2 & Mid(strOutput, i, 1)
Next i
End If
response.write (strOutput2)
%>
I am trying to alter a text string to create a valid boolean query for
an index server search.
At the moment because the text string is created using combo boxes it
can have 2 or more 'AND's in succession.
Like This (strInput):
"Company AND Credit AND AND London AND AND Richmond Short Term AND AND
Intercompany AND Investment Bank AND Covertible AND AND "
what I want to do is change the above string to (strOutput2):
"Company AND Credit AND London AND Richmond AND Short Term AND
Intercompany AND Investment Bank AND Covertible"
I am trying to do it with the code below:
However this code produces problems as I loop through the various
search items.
It works fine in VB but fails when I try to port it to ASP.
If anyone has any ideas on how to fix this code, or alternative
suggestions, I would be most grateful.
Best Regards
O'Donnell Abu
CODE BELOW
<%
Dim strInput, strOutput, strOutput2 , bytLen , bytSW, i, ii
strInput = "Company AND Credit AND AND London AND AND Richmond Short
Term AND AND Intercompany AND Investment Bank AND Covertible AND AND "
bytLen = Len(strInput)
bytSW = 0
For i = 1 To bytLen
If bytSW > 0 Then
If bytSW = 1 Then
bytSW = 0
End If
If bytSW = 2 Then
bytSW = 1
End If
If bytSW = 3 Then
bytSW = 2
End If
If bytSW = 4 Then
bytSW = 3
End If
End If
If Mid(strInput, i, 3) = "AND" Then
If Mid(strInput, i, 7) = "AND AND" Then
bytSW = 4
If bytSW = 1 Then
bytSW = 0
End If
If bytSW = 2 Then
bytSW = 1
End If
If bytSW = 3 Then
bytSW = 2
End If
If bytSW = 4 Then
bytSW = 3
End If
End If
End If
strOutput = strOutput & Mid(strInput, i, 1)
Next i
If Right(strOutput, 4) = "AND " Then
ii = Len(strOutput)
ii = (ii - 4)
For i = 1 To ii
strOutput2 = strOutput2 & Mid(strOutput, i, 1)
Next i
End If
response.write (strOutput2)
%>