Win a copy of Learning Java by Building Android Games this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

How to use getStringArray of ResourceBundle  RSS feed

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to get the array of string from a property file using the
getStringArray of ResourceBundle class. But it is giving class cast Exception.
My property file looks like:

NVFORMS="GSLTW1NV","GSLTW1NV","GSLTW1NV","GSLTW1NV","GSLTW1NV","GSLTW1NV"
I also tried following formats. None of them worked.

NVFORMS= GSLTW1NV1 GSLTW1NV2 GSLTW1NV3
NVFORMS={"GSLTW1NV1", "GSLTW1NV2", "GSLTW1NV3"}

So if you have worked on this before successfully, please let me know.
(No speculations please )
Thanks in advance.
 
Ranch Hand
Posts: 118
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been looking around... I can't find much information on it. You can use this for now though:

[ July 09, 2004: Message edited by: Darin Niard ]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darin Niard wrote:I've been looking around... I can't find much information on it. You can use this for now though:

[ July 09, 2004: Message edited by: Darin Niard ]



thanks but did you try it , i mean where is your reference
 
Ranch Hand
Posts: 48
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

shareeef hiasat wrote:

Darin Niard wrote:I've been looking around... I can't find much information on it. You can use this for now though:

[ July 09, 2004: Message edited by: Darin Niard ]



thanks but did you try it , i mean where is your reference



This should work.
This is a general code.
rb.getString("NVFORMS").split(":"); is valid code.
But need to do the null check.

String[] s=null;
if(rb.getString("NVFORMS") !=null){
s = rb.getString("NVFORMS").split(":");
}


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!