If it's in the true value/pair Java properties format, prop=value, then
there is an easier solution.

public class TestClass {

private static final String NEWLINE =

public static void main(String[] args) {
String[] s = new String[3];
s[0] = "prop1=test1";
s[1] = "prop2=test2";
s[2] = "prop3=test3";
Properties props = new Properties();
try {
props.load(new StringReader(stringFromArray(s)));
} catch (IOException e) {

protected static String stringFromArray(String[] array) {
StringBuilder sb = new StringBuilder();
for (String string : array) {
return sb.toString();

James R. Perkins

On Tue, Sep 15, 2009 at 06:46, Lim Hock-Chai

Yes, it is in a nice property format. My code looks like below:

Properties prop = new Properties();
for (int i=0; i <rs.length; i++) {
String keyValue[] = rs[i].split("=");
if (keyValue[0] !=null && keyValue[1] != null)
prop.setProperty(keyValue[0], keyValue[1]);

"Thorbjoern Ravn Andersen" <ravn@xxxxxxxxxx> wrote in message news:<
Lim Hock-Chai skrev:
That will work. Thanks David.

Note, it will break if the "====>" string is present more than once on a

I did not understand that those were the actual lines, I just thought we
had a nice property file as a string array. Oh well, glad you got it

Thorbjørn Ravn Andersen " Tubular Bells!"

This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.