• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Parsing var2={$var1.desc} like property

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

What is the easiest way to parse the following properties information:

## My properties file
var1=c:/temp
var2={$var1}/subdir/test
var3=something/{$var2}/etc


Is there any helper API to accomplish this or I still have to load the properties and pars them programmatically.

Thanks in advance.

JL
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That depends a good deal on what the purpose of the parsing is. If you want to extract the {...} sections and replace the variables, then that might be accomplished by using regular expressions.
[ August 25, 2005: Message edited by: Ulf Dittmer ]
 
Jose Ortuno
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK,

I am gonna review reg. exp. to eval & replace {$varname} by the value.

Thanks for writting..!!
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See if Properties or PropertyResourceBundle do it for you.
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With a slight modification to your .properties file,

var1=c:/temp
var2={0}/subdir/test/{1}/test/{2}/data
var3=something/{0}/etc

======================



In fact, if you are doing web apps, you may want to consider using something like Struts because it has capabilities to grab the value with up to 4 parameters I think, ie: you can be lazy and use the built in API rather than write it yourself.
 
Jose Ortuno
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, a lot..!
 
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic