Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't create array :( 1

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
hi, i'm really lost as to what happening here, x has the correct string value but myArray = Split(x," ") doesn't work...?

this is what i have:

<%

dim myArray
dim Sftp, item
dim s,rx,cm,t,x,i

set Sftp = Server.CreateObject("WeOnlyDo.wodSFTPCom.1") ' registerd the dll in system32 folder WindowServer 2003
Sftp.LicenseKey = "xxxxxxxx"
Sftp.Timeout = 60
Sftp.Login = "xxxx"
Sftp.Password = "xxxxxxxxxxxxxxxx"
Sftp.HostName = "ftp.xxxxxx.com"
Sftp.Blocking = 1
Sftp.Connect


Sftp.ListNames "/ftp/ 'parsing file names from remote Unix server

x = Trim(Sftp.ListItem) ' get file names and set as a string to x

Sftp.Disconnect
Response.Flush
set Sftp = Nothing

response.write x ' give correct value


myArray = Split(x," ")

for i = 4 to Ubound(myArray)
Response.write myArray(i) & "<br>"
next


%>
 
Hi DNG, i'm not getting an error is if i
response.write "x: " & Ubound(myArray)
i get this: x: 0

if i take away the Sftp code for the dll, another words i just have the x value hard coded to the variable and just plain old classic asp on the page then the asp works fine and i can access the array.

I'm wondering if when the object was created if it made the string not a string but something else?
 
Also I just noticed the the string that x is set to has a space at the end of it and that x = Trim(Sftp.ListItem)
doesn't remove the space at the end. I can set this string to a variable but can't seem to do anything with it.

any thoughts to this? Thanks
 
ok i found out that the value i set to x from the custom dll is a string but one that is not available as a variable. So i can parse the string like Left(x,33) but actually cannot manipulate the string due to SSH and sFTP security methods. so now i'm looking for a way to parse the string for all characters after the begining part of: " ../ .bash_history "

another words this would have been the replace method:
replace(x,"./ ../ .bash_history ","")

so how can i parse a string of unknow length for its characters minus the begining part of ./ ../ .bash_history

Thanks
 
Look at using the Len() function and the Instr() function

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
If split(x," ") return ubound 0, it does not lie. Hence the separator is not " " (or %20 after escape(x)). You should echo x for inspection.
[tt]response.write x & "<br />" & escape(x)[/tt]
watch for %20 or the lack of it.
 
How does the data look?
Is it like a recordset? 1
2
3
or is it on string like: 1 2 3

If its like 1 2 3 with spaces then you split(x," ") would work: arrmyarray = split(x, " ")
this would put x into the arrmyarray array.
If its like a Recordset then just use it like a recordset and loop throught it.
 
i agree with tsuji...the spaces which you are seeing may not be the actual spaces(chr(32))...they may be tabs or vbcrlf's or something else...

-DNG
 
Well tsuji, good call, that spaces were actually: %D%A

so i uelEncoded the string and splited on that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top