|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Compile error with substring()
I'm a little puzzled by the compile error in visual basic 6.0, it said 'invalid qualifier' when i use the method, substring(x,x). I noticed that visual basic doesn't recognize the substring, so what is the supported function where I can take a partical string out of the full string???
Thanks.... |
|
#2
|
||||
|
||||
|
Alright, found out that I would need to use Mid() instead. Rigth now I'm still getting the compile error with 'invalid qualifier'. So, what did I do wrong with the script??
--snip-- Private Function CBC_XML_BreakUp(ByVal strCBC_Response As String, strResponse_XML As String, strResponse_HTML As String) Dim i As Integer Dim iCBC_Response_Len As Integer Dim iXML_Start As String Dim iXML_End As String Dim iHTML_Start As String Dim iHTML_End As String iCBC_Response_Len = Len(strCBC_Response) iXML_Start = "Null!" iXML_End = "Null!" iHTML_Start = "Null!" iHTML_End = "Null!" '//This loop work only for [XML[XML[HTML]]], not [XML[XML][HTML]]... '//If the 'Options' variable in the Query URL string is altered to receive [XML[XML][HTML]] then this loop is invalid and a new loop script is needed... For i = 0 To iCBC_Response_Len If strCBC_Response.Mid(i, 9) = "<![CDATA[" Then If iXML_Start = "Null!" Then ' iXML_Start = str((i + 9)) Else ' iHTML_Start = str(i + 9) End If End If If strCBC_Response.Mid(i, 3) = "]]>" Then If iHTML_End = "Null!" Then ' iHTML_End = str(i) Else ' iXML_End = str(i) End If End If Next '//This few lines of codes loop work only for [XML[XML[HTML]]], not [XML[XML][HTML]]... '//If the 'Options' variable in the Query URL string is altered to receive [XML[XML][HTML]] then this loop is invalid and a new loop script is needed... ' strResponse_HTML = strCBC_Response.Mid(iHTML_Start, iHTML_End) ' strResponse_XML = strCBC_Response.substring(iXML_Start, (iHTML_Start - 9)) + strCBC_Response.substring((iHTML_End + 3), iXML_End) End Function --snip-- |
|
#3
|
||||
|
||||
|
Are you using VB 6 ? if you are then the following should look like this
Code:
'//This loop work only for [XML[XML[HTML]]], not [XML[XML][HTML]]... '//If the 'Options' variable in the Query URL string is altered to receive [XML[XML][HTML]] then this loop is invalid and a new loop script is needed... For i = 0 To iCBC_Response_Len ' THIS IS YOUR VERSION 'If strCBC_Response.Mid(i, 9) = "<![CDATA[" Then 'If iXML_Start = "Null!" Then 'IT SHOULD LOOK LIKE THIS If mid(strCBC_Response,i,9) = "<![CDATA[" Then if iXML_Start = "Null!" Then ' iXML_Start = str((i + 9)) Else ' iHTML_Start = str(i + 9) End If End If
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#4
|
||||
|
||||
|
..
That does help to fix the problem. Thanks... I get a different error, this time a call error. It had me puzzled, the employee told me that in visual basic, the loop start with one, not with zero as is usually done in C++, PHP, JavaScript, C, etc... So, that fix the other problem. Now it is working great....
Scott |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Compile error with substring() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|