• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String[ ] to File[ ]

 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a doubt. Can String array be casted to a File Object array?
It seems to be okay, but just wanna confirm this as the code where i have implemented this can not be build and executed now to check this.
The string array contains the abolute paths to files.
Any comments on this will be appreciated,
Thanks.
 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anupam Bhatt:
Hi,
I have a doubt. Can String array be casted to a File Object array?
It seems to be okay, but just wanna confirm this as the code where i have implemented this can not be build and executed now to check this.
The string array contains the abolute paths to files.
Any comments on this will be appreciated,
Thanks.


A String object can *not* be casted to a File object.

A String array object can *not* be casted to a File array object.

Henry
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry, Thanks for this.
So now my problem is i have a array of strings[which contains absolute paths to file], but i want to return a array of file objects.

What can be the best possible approach to this ?

Thanks
 
Shyam Prasad Murarka
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Anupam,
I have no idea if this is the best way to do it. But, here's what I suggest:
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shyam,
Thats what exactly what i thought the solution and did. And your reply confirms the same .
Thanks,


Originally posted by Shyam Murarka:
Dear Anupam,
I have no idea if this is the best way to do it. But, here's what I suggest:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic